View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sharad Naik Sharad Naik is offline
external usenet poster
 
Posts: 212
Default Opening Excel from Access

I think you must have tried already, but forgot to set Excel to visible.
Once you set it to visible all remaining code is same as in excel macros.
You can use below code.

Sub olExcelOpen()
Dim exApp As Excel.Application
Dim myBook As Excel.Workbook
Set exApp = CreateObject("Excel.Application")
exApp.Visible = True
Set myBook = exApp.Workbooks.Open(FileName:="Path to the file",
ReadOnly:=True)
myBook.RunAutoMacros xlAutoOpen
End Sub

Sharad

"Steve Price" wrote in message
...
Didn't know whether to post this here or under Access.

Basically, how do you open an Excel worksheet from Access in code?

Also, the Excel worksheet uses Macro's and is read only/protected. Is it
possible for the warnings to be surpressed? i.e. Instead of the user being
asked whether to allow macros, these are automatically allowed. And
instead
of accessing to enter password to modify workbook, 'read only' is
automatically chosen.


Thanks