Open Excel Workbooks

Neal

Registered User.
Local time
Today, 19:28
Joined
Feb 17, 2000
Messages
116
Can anyone give me the code to open an an existing Excel Workbook from Access. I have tried Getobject following the help file instructions, but all that happens is Excel opens briefly, then closes.
Thanks,
Neal
 
some way first of them:

see help DoCmd.TransferSpreadsheet ...

other via DAO Connect
glad to answer
 
I need to do more than transfer the spreadsheet. I need to open Excel, run a macro, save the file, then import the spreadsheet.
 
some ways onem of them
...
Dim XCL As Long
On Error Resume Next
XCL = DDEInitiate("Excel", "System")
If Err Then
Err = 0
Shell "Excel.exe ""C:\TMP\BOOK1.XLS""", 1
If Err Then Exit Sub
XCL = DDEInitiate("Excel", "System")
End If
DDEExecute XCL, "[Run(""prim"")]"
DDETerminateAll
...

PS
1)disable warning message about startup macro
in Excel
2) prim is name of macro in excel
3) dont forget insert -
ActiveWorkbook.Save
into the end of prim macro

but i recommend you do via DAO
 

Users who are viewing this thread

Back
Top Bottom