View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Workbook Open method

Gwen,

Change
xlapp.Workbooks.Open ("strfilename,,,password")
to
xlapp.Workbooks.Open strfilename,,,password ' no quotes or
parens


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Gwen" wrote in message
...
Please help,

When I attempt to use the Excel workbook open method with
options in MS Access, I get an error message saying it
can't find the file.
I want to programmatically open an excel file that is
password protected and daily transfer this file to
Access. (I have the password).


Dim xlapp As Excel.Application
Dim xlworkbook As Excel.Workbooks
Dim strFileName As String

Set xlapp = CreateObject("Excel.application")
xlapp.Workbooks.Open ("strfilename,,,password")
xlapp.Visible = True
DoCmd.TransferSpreadsheet acImport,
acSpreadsheetTypeExcel97, tbl1, strFileName

xlapp.Quit
Set xlapp = Nothing