Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Excel Macro to open an existing excel workbook


The following Excel VBA code to open an existing excel workbook which is existing in a given path.

Sub openExcelWorkbook()
    Dim wb As Workbook
    Dim fPath As String

    fPath = "D:\vbausefulcodes.xlsx"
    Set wb = workbooks.Open(Filename:=fPath)
    'given workbook is opened and it is referred by
    ' the variable wb of type workbook
    ' now you can do all the operations on wb which
    ' you want to do on this workbook

    'For Example to close this workbook
    wb.Close
End Sub

Subscribe

Enter your e-mail below and get notified on the latest blog posts.




Tags

VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts


Follow Us