MrExcel Publishing
Your One Stop for Excel Tips & Solutions

printing excel from the web?

Posted by Eric Stacy on June 22, 2000 8:42 AM

I have an excel workbook in which I need to put on the web. Management wants me to find a way to put the work book up with a button/method to print the entire thing with one button/command. If I put the workbook in its own frame, then click print on the browser the whole book prints. The problem there is that the workbook may not appear in the browser window, but in the excel window. Due to the settings on the managments personal machines. I was wanting to know if anyone had any solutions to this problem, understanding that the users of the information I am speaking of will be viewed by technologicly chalanged. Thank you in advance!

Posted by Damien on June 30, 0100 12:47 PM


I have a solution for you. You are not out of luck. You should record a macro to execute the print command for all sheets. Then reopen the code module, and place a message box within the VB code to pop up when the page loads in the workbook's load event. Since the buttons you choose on a message box return a value, for example I believe OK returns a 1, cancel a 0, yes maybe a 6, and 7 a no, i could be wrong on those values - well anyway after the message box, if they click on yes, it will return a 6, so write an If-Then statement in the code to execute the print macro you recorded. If (value message box returns) = 6 Then (execute the print all sheets macro)

Hope that works for ya cat, if not post a retraction and i'll give ya the code.

Aw screw it here's the macro
' Keyboard Shortcut: Ctrl+p
Dim Number As Integer
Number = MsgBox("Print all charts?", vbYesNo, "Print")
If Number = 6 Then
Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5", _"Sheet6")).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
End Sub



Posted by Mike Faulkner on June 23, 0100 1:43 PM

I believe you may be out of luck Eric.

Browser security protocol prevents any sort of print automation within a browser.

As for the Excel window opening inside the browser...that feature only works if the PC has Office 2000 installed. I'm guessing your office has different versions running on different machines.

Sorry I couldn't bring you more positive news.