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:
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
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