Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close Excel through Access??

Status
Not open for further replies.

belstoy

Technical User
May 31, 2005
37
US
Hello,

I am attempting to close Excel through Access with an Auto_Exec Macro using the RunCode option.

Initially the code in my module was as follows:


Code:
Sub test()
Dim y as Object
Set y = GetObject(,"Excel.Application")
y.DisplayAlerts = False
y.Quit
Set y = Nothing
End Sub

I could run this manually and it worked great. Now that I am trying to automate with a macro, I am having issues.
I have replaced the Sub test() with Public Function test()and End Sub with End Function.

When this Function is selected in RunCode, it does not work. Why does it work as a Sub, but not as a Public Function?

I cannot automate unless I can close Excel using a Public Function.

Help!

Belstoy
 
This issue has been resolved off-line.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top