Hello,
I am running the code from an Access Macro. I have tried using variations of the following code -
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Open FileName:="c:filepath\filename", Password:="whatever"
Set xlBook = xlApp.Workbooks.Add
Set xlSheet_MetLife = xlBook.Worksheets.Add
This code creates a new workbook instead of using the other workbook. If I omit the createobject line, it gives me an object variable not set error.
I have also tried -
Set xlApp = GetObject("c:\filepath\filename.xls")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet_MetLife = xlBook.Worksheets.Add
but this won't let me set the password.
Any suggestions would be appreciated.
cmz
'Set xlApp = GetObject("c:\filepath\filename.xls")
xlApp.Workbooks.Open FileName:="c:filepath\filename", Password:="whatever"
Set xlBook = xlApp.Workbooks.Add
'Set xlBook = xlApp.Workbooks.Open FileName:="c:\filepath\filename.xls", Password:="whatever"
Set xlSheet_MetLife = xlBook.Worksheets.Add