I have around 8 workbooks each with about 30 worksheets in them.
Is there anyway i can create a new workbook with a sheet containing several buttons. When one of the buttons is pressed it will print out a number of specific sheets from the workbooks?
Good afternoon andycreighton
Welcome to the forum!
This sounds like just the kind of job that the macro recorder was built for. Go to Tools > Macro > Record new macro and go through the tasks you want to do - opening, selecting sheets, printing closing etc - then click on the stop recording button.
Design a button using the Forms toolbar, right click the button and assign the macro you've just created to it.
Good luck!
HTH
DominicB
Is there any way you can print a sheet without haveing to unhide it??
Cheers
Andrew C
Good morning andrewbc
No. But you can use a macro to unhide the sheet, print it and rehide it again. If you use the line :
at the start of your macro and set the flag back to true at the end, then the user will never see the sheet being unhidden.Application.ScreenUpdating=False
Why have you reregistered under a different name?
HTH
DominicB
Last edited by dominicb; 01-11-2007 at 02:56 AM.
I attempted recording a macro in a new work book to print them all but got Run-Time error 9; Subscript out of range.
Also when i looked at the VBA the code read....
ActiveWindow.ScrollWorkbookTabs Sheets:=7
Sheets("GRAYSTONE").Select
Im assuming that means the workbook has to physically be open to work. Is there anyway to do it without having to open them beforehand?
Thanks
Andy
Hi andycreighton
No, you have to open the workbook to print it. However, you can hide the opening of a spreadhseet from the user by using the Application.ScreenUpdating command. The macro below has been part recorded by my, and I then added manually the first and last line which will stop the user from seeing the file open and close. All they will experience is a slight delay.
HTHSub Macro1() ' ' Macro1 Macro ' Macro recorded 11/01/2007 by Dominic Brown1 ' ' Application.ScreenUpdating = False Workbooks.Open Filename:="D:\Work\Analysis-Output.xls" ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True ActiveWindow.Close Application.ScreenUpdating = True End Sub
DominicB
Cheers that works like a charm.
Is there anyway I can print more than 1 sheet? also is there anyway i can choose which sheets to print?
Thanks again
Andy
EDIT: btw andrewbc is not me lol
Last edited by andycreighton; 01-11-2007 at 06:48 AM.
Hi andycreighton
Sure - just use the macro recorder and print more than one sheet before closing the file and turning off the recorder.Is there anyway I can print more than 1 sheet?
Phew! Now you're getting into the heavy stuff - you would need to read the sheetnames of the new sheet into an object for the user to see, read what the user has selected and act accordingly - all without ever showing the user the sheet they've selected. Not the type of stuff you can achieve with the recorder. Have a look at this little spreadsheet I've put together - should do the trick for you...also is there anyway i can choose which sheets to print?
HTH
DominicB
Last edited by dominicb; 08-19-2008 at 04:29 AM.
Wow thats class lol cheers.
Your gonna hate me, but I have one more question. The sheets I will be printing off each week will be the same everytime. Is there anyway I could bring up a list of predefined customers lol say for example.
There were 10 customers, each with thier own seperate invoice.
Shop 1
Shop 2
Shop 3
Shop 4
Shop 5
Shop 6
Shop 7
Shop 8
Shop 9
Shop 10
But I only wanted to print off invoices from shop 1, 4, 8 and 10. This will be the same every week and will not change. I dont want the user to have to manually select the sheets to print off. Is it possible?
Last edited by andycreighton; 01-11-2007 at 07:30 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks