Good day, all.
I'm a newbie and trying to open an excel spreadsheet with VBA code in a 2013 MS Access. Can someone help to provide the VBA code ?
Appreciate your help.
Good day, all.
I'm a newbie and trying to open an excel spreadsheet with VBA code in a 2013 MS Access. Can someone help to provide the VBA code ?
Appreciate your help.
By far the simplest way is to use application.followhyperlink , as this will use the windows default application for whatever the target file is;
You can however use automation to open an excel application directly and do a lot more;Code:Application.Followhyperlink "C:\ExcelStorage\MyExcelFile.xlsx"
Code:' Late binding to avoid reference issues: Dim xlApp As Object 'Excel.Application Dim xlWB As Object 'Workbook Dim xlWS As Object 'Worksheet Dim sFile As String Dim sSheet As String sFile = "C:\ExcelStorage\MyExcelFile.xlsx" sSheet = "MyWorkbookSheetName" Set xlApp = CreateObject("Excel.Application") xlApp.Visible = bOpen Set xlWB = xlApp.Workbooks.Open(sFile) Set xlWS = xlWB.Worksheets(sSheet)
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
Thank you Minty, for your quick reply.
Set xlWB = xlApp.Workbooks.Open(sFile)
sFile = ????
DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
Please use the star below the post to say thanks if we have helped !
↓↓ It's down here ↓↓
I'd tried it out. It works
Thanks again, Minty