S
Sam
I have an Excel file with a button to run a macro: select sheets and
print preview. It works when the file is opened with Excel. The macro
is simple:
Sub PrintMacro()
Sheets(Array("tables", "data", "charts")).Select
Sheets("tables").Activate
ActiveWindow.SelectedSheets.PrintPreview
End Sub
I need to open it from web. When user selects the file, the web app
retrieves the file and responses to open an Excel file. So I built a
web app using Weblogic and Struts. After user clicks the link to the
file, an Excel file was loaded from the server with chart, data, and a
button to trigger the macro. The title bar shows: Microsoft Excel -
http://myhostname:myportnumber/mywebapp/reportaction.do?file=20040624
[Group] [Read only]. It works so far.
But when click the button, an Excel message box appears: The macro
''reportaction.do?file=20040624'!PrintMacro' cannot be found.
If look into Tools/Marco, PrintMacro can be found in 3 "Macros in"
status: 1. All Open Workbooks, 2. This Workbook, and 3.
reportaction.do?file=20040624. Click Run in Macro window, it runs in 3
status. Or if the file saved and reopend, click the button and it
works.
Could anyone know why is it and the way to solve the problem?
Thanks so much!
Sam
print preview. It works when the file is opened with Excel. The macro
is simple:
Sub PrintMacro()
Sheets(Array("tables", "data", "charts")).Select
Sheets("tables").Activate
ActiveWindow.SelectedSheets.PrintPreview
End Sub
I need to open it from web. When user selects the file, the web app
retrieves the file and responses to open an Excel file. So I built a
web app using Weblogic and Struts. After user clicks the link to the
file, an Excel file was loaded from the server with chart, data, and a
button to trigger the macro. The title bar shows: Microsoft Excel -
http://myhostname:myportnumber/mywebapp/reportaction.do?file=20040624
[Group] [Read only]. It works so far.
But when click the button, an Excel message box appears: The macro
''reportaction.do?file=20040624'!PrintMacro' cannot be found.
If look into Tools/Marco, PrintMacro can be found in 3 "Macros in"
status: 1. All Open Workbooks, 2. This Workbook, and 3.
reportaction.do?file=20040624. Click Run in Macro window, it runs in 3
status. Or if the file saved and reopend, click the button and it
works.
Could anyone know why is it and the way to solve the problem?
Thanks so much!
Sam