Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

How To Opened An Excel File Using Vba

Simple guide to use vba codes to open an excel file with or without passowrd

Uploaded by

Lenu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

How To Opened An Excel File Using Vba

Simple guide to use vba codes to open an excel file with or without passowrd

Uploaded by

Lenu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

How to opened an excel file using vba

Public Function OpenExcelFile(strFilePath As String) As Boolean


'References: Add reference to Microsoft Excel Object Library

Dim appExcel As Excel.Application


Dim myWorkbook As Excel.Workbook

Set appExcel = CreateObject("Excel.Application")


Set myWorkbook = appExcel.Workbooks.Open(strFilePath)
appExcel.Visible = True

'Do Something or Just Leave Open

Set appExcel = Nothing


Set myWorkbook = Nothing
Prepared by
degodofnet@yahoo.com
End Function
How to opened an excel file using vba
'Usage Example
Sub OpenExcelFile_Example()
Call OpenExcelFile("C:\Users\PC2\Downloads\nletest.xlsx")
End Sub

----------------
usage with password
Workbooks.Open "C:\Users\nlep1\Desktop\myFile.xlsx", , , Password:="test123“

Credit: https://www.automateexcel.com/vba-code-examples/

Prepared by
degodofnet@yahoo.com

You might also like