How to import data from Excel that has password protected shee?

B

Boon

this did not work...

I have a vba code that will import the data from the excel file. I open the
excel file,import it and close it. But I think I have the problem with
closing it.The VBA works fine, but when I reopen the excel file from the
file inself, it says something about the Read Only, Notify......

Here is my code

Function ImportBidData(FileName As String)
Set excel = CreateObject("excel.Application")

excel.workbooks.Open (FileName)

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,
"tbl_Temp_Quote1", FileName, False, "Quote1Direct"

excel.workbooks.Close

excel.Quit

Set excel = Nothing
 
J

J_Goddard via AccessMonster.com

Hi -

Using TransferSpreadsheet means you don't need the to explicitly open & close
the Excel file. Try removing the references to it - you are not using those
references in the TransferSpreadsheet command anyway.

John

this did not work...

I have a vba code that will import the data from the excel file. I open the
excel file,import it and close it. But I think I have the problem with
closing it.The VBA works fine, but when I reopen the excel file from the
file inself, it says something about the Read Only, Notify......

Here is my code

Function ImportBidData(FileName As String)
Set excel = CreateObject("excel.Application")

excel.workbooks.Open (FileName)

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12,
"tbl_Temp_Quote1", FileName, False, "Quote1Direct"

excel.workbooks.Close

excel.Quit

Set excel = Nothing
What did not work about it?
[quoted text clipped - 3 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top