More on using Excel from Access????

pdbowling

Registered User.
Local time
Today, 23:23
Joined
Feb 14, 2003
Messages
179
George Too, very nice code for exporting. It solved many problems. What's the syntax for launching an Excel macro in the

With ExcelApp mode?

So far I have

Set ExcelApp = CreateObject("Excel.Application")

'With the new workbook do the following
With ExcelApp
.workbooks.Open "S:\RM\Hazmat\HazmatTraining Recap.xls" 'File to open
.Visible = True

'''''''need to launch a macro from this workbook here'''''''

'Save the results.
.ActiveWorkbook.Save
'Close and quit
.ActiveWindow.Close
End With

ExcelApp.Quit
Set ExcelApp = Nothing


much much appreciated. Thank you
 
How about calling the code within Excel Sub Auto_Open() then when it is opened the code will run automaticaly?
 
Ooo

You know, that is a great idea. The only difficulty is that my boss wants me to automate something that is already in use, so I can't make this file autorun a macro because they use it every day and the macro updates the data. Good thinking though.
PB
 
I had a similar situation. What I did was to copy the vb code from the macro in Excel and pasted it into the code in Access. It worked wonderfully. That way the macro runs in the sheet that I'm creating.

Give it a try,
George
 

Users who are viewing this thread

Back
Top Bottom