This is a multi-part question...
1) From within my Access-2000 application (button-clicked event on a form), I want to open an Excel file that has macros in it AND launch a macro.
2) From within the now opened Excel file, I want to reference the values of Unbound fields on the forms in the Access application.
I created an excel file to test -- initially with no macros.
This event code worked fine to open the file, and make it the visible and active application:
Dim MyXL as Object
Set MyXL = GetObject("C:\QUERYOUTPUT_001.XLS")
MyXL.Application.Visible = True
MyXL.Parent.Windows(1).Visible = True
Next, I added a simple macro (Macro1 -- it puts the current row number in the active cell). Also note that Macro security is set to Medium. With this setting, if I open the excel file manually, I get a pop-up window that ask me to choose "Enable" or "Disable" macros.
When I run the event code to open the file with macros, I get a different pop-up titled "Microsoft Excel" that has more verbiage (about the file has macros, yadda-yadda...) and offers three choices "Yes", "No", "Cancel"
If I click on "No", the macro does not function (as expected).
If I click on "Yes", the macro still does not function -- and I get a pop-up box titled "Microsoft Excel" that says "The macro 'Macro1' cannot be found."
Any help would be greatly appreciated.
-smr