automation security error

M

Monique

when using the code below, i receive an error stating:
Compile error:
Method or data member not found

It was working previously and now it doesn't. I just want to be able to open
the database without the security warning appearing... import a file into it
and close the database... any suggestions would be greatly appreciated.

thanks

Private Sub ExportXLS()

Dim dbrem As Access.Application
Dim accAutoSec As MsoAutomationSecurity

Set dbrem = New Access.Application

accAutoSec = dbrem.AutomationSecurity

With dbrem
.Visible = True
.AutomationSecurity = msoAutomationSecurityLow
.OpenCurrentDatabase "C:\ReName.mdb"
End With

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "OverStock",
"C:\test.xls", True, "Stock"

With dbrem
.AutomationSecurity = accAutoSec
.Visible = False
.CloseCurrentDatabase
End With

Set dbrem = Nothing

End Sub
 

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