|
Print all Embedded Charts in the Entire Workbook
This macro will print every embedded chart in the active workbook. If you have an embedded chart in any worksheet within the workbook, it will be printed. This macro will print the charts on separate pages so that each chart will be on its own page.
Where to install the macro: Module
Print all Embedded Charts in the Workbook
Sub PrintEmbeddedChartsinWORKBOOK()
'This macro will print all embedded charts in the active workbook
'
Application.ScreenUpdating = False
Dim Sht As Object
Dim Cht As ChartObject
For Each Sht In ActiveWorkbook.Sheets
For Each Cht In Sht.ChartObjects
Cht.Activate
ActiveChart.ChartArea.Select
ActiveWindow.SelectedSheets.PrintOut
Next
Next
End Sub
How to Install the Macro
- Select and copy the text from within the grey box above.
- Open the Microsoft Excel file in which you would like the Macro to function.
- Press "Alt + F11" - This will open the Visual Basic Editor - Works for all Excel Versions.
Or For other ways to get there, Click Here.
For Excel Versions Prior to Excel 2007 Go to Tools > Macros > Visual Basic Editor
For Excel 2007 Go to Office Button > Excel Options > Popular > Click Show Developer tab in the Ribbon. Then go to the Developer tab on the ribbon menu and on the far left Click Visual Basic
- On the new window that opens up, go to the left side where the vertical pane is located. Locate your Excel file; it will be called VBAProject (YOUR FILE'S NAME HERE) and click this.
- If the Macro goes in a Module, Click Here, otherwise continue to Step 8.
- Go to the menu at the top of the window and click Insert > Module
- Another window should have opened within the Visual Basic Editor's window. Within this new window, paste the macro code. Make sure to paste the code underneath the last line of anything else that is in the window.
- Go to Step 8.
- If the Macro goes in the Workbook or ThisWorkbook, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Then, at the bottom of the list that appears, double-click the ThisWorkbook text.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Go to Step 8.
- If the Macro goes in the Worksheet Code, Click Here, otherwise continue to Step 8.
- Directly underneath your excel file called VBAProject(your file's name here), click the Microsoft Excel Objects folder icon to open that drop-down list.
- Within the list that appears you will see every worksheet that is in that excel file. They will be listed as such: Sheet1(NAME OF SHEET HERE) and under that will be Sheet2(NAME OF SHEET HERE). Select the sheet in which you want the macro to run and double-click that sheet.
- A new window inside the Visual Basic Editor's window will appear. In this new window, paste the code for the macro. Make sure to paste this code underneath the last line of any other code which is already in the window.
- Repeat steps b and c for every sheet you want the macro to work in. Putting the macro in one sheet will not enable it for any other sheets in the workbook.
- Go to Step 8.
- Close the Microsoft Visual Basic Editor window and save the Excel file. When you close the Visual Basic Editor window, the regular Excel window will not close.
- You are now ready to run the macro.
Similar Helpful Excel Resources
Disclaimer: I have only a little experience with VBA from years ago. I have attempted a search for a similar situation, but did not find any that I could relate to my problem.
I have two workbooks with data, named WbTest and WbMaster. In WbTest column B, I have serial numbers for specific tests which I need to find in WbMaster, which contains info on every possible test serial number. In WbMaster the serial numbers may appear in different columns and embeded in surrounding text. After finding the corresponding serial number I must copy the entire row of data that it is located in into a new workbook. I would end up with WbResult that has only the row of info for each test serial number in WbTest.
Thus far, I have been manually copying the serial number from WbTest, switching to WbMaster, hiting Ctrl+F, pasting the number, finding the corresponding number, and manually copying the row to WbResult. This has worked fine until the WbTest dataset became very large and I have to repeat this operation many times. I am hoping a recursive VBA code may solve some of my problems.
Any help would be very much appreciated.
I have a workbook that has 17 work sheets. I am wondering if there is a way to set all 17 work sheets to print in Landscape and fit to page without having to go into each sheet and make the settings individually.
What I would like is that all 17 work sheets print in landscape mode - and the contents of each sheet to fit to the page.
Is this possible?
Any help would be appreciated.
Thanks,
Tp
Hello. I've seen many posts about printing a whole workbook, but I am having trouble with this scenario:
I wrote code (see below) to print, but if the user selects "no", I want the options to pre-fill to print the entire workbook. I can't figure out which argument it is, and how to activate it. Thanks
Code:
Sub Print_()
Dim Answer As String
Answer = MsgBox("Use Default Printer?", vbYesNo, "Printer")
If Answer = vbYes Then
Application.ScreenUpdating = False
Sheets("Setup").Visible = False
ActiveWorkbook.PrintOut Copies:=1, Collate:=True
Else
Application.ScreenUpdating = False
Sheets("Setup").Visible = False
Application.Dialogs.Item(xlDialogPrint).Show
End If
Sheets("Setup").Visible = True
Sheets("Setup").Select
Application.ScreenUpdating = True
End Sub
other then VBA is there a way to save a workbook, that when you need to print it, it will print all sheets
I know you can go to print window and check entire workbook, but would like to have it saved that way.
Reason being some employees are not all that computer savy.
Thanks in advance for any help
I have a workbook that has 17 work sheets. I am wondering if there is a way to set all 17 work sheets to print in Landscape and fit to page without having to go into each sheet and make the settings individually.
What I would like is that all 17 work sheets print in landscape mode - and the contents of each sheet to fit to the page.
Is this possible?
Any help would be appreciated.
Thanks,
Tp
I have multiple sheets on a work book. I would to print the whole work book with out page breaks between each sheet. As at the moment when you print the entire work book each sheet starts on a new page. I want the new sheet to sart directly under the first sheet. Does any one have a solution.
I know I can create a toolbar button to do this, but I'm wondering if
there's a registry key (eg, under
HKCU\Software\Microsoft\Office\10.0\Excel\Options) to make 'entire workbook'
the default print option instead of 'active sheet'. Is there a list of reg
keys for this path?
Thanks,
Mike
I have a workbook with 20 sheets. Each sheet has been formatted with a print area to print a single page for that sheet. If I select entire workbook and view the job, there are, as expected, 20 pages. When the job is printed, I end up with 2 entries in my print queue...page 1 and the other 19 pages. BTW, the first sheet is very sparse (like a cover page).
If I delete the first sheet and print the entire workbook, it creates a single print queue entry for all 19 pages.
The reason that this is an issue is that when this (original) document is printed to a usb Lexmark printer, the sngle page job causes the printer to hang. It gets real messy from there, ultimately requiring a reboot.
If this same document is printed to a usb Canon printer, it still creates 2 print queue entries, but it all prints just fine.
Has anyone else experienced this problem and/or know what to do?
Hi,
I'm trying to view all the tabs of a workbook by selecting:
File | Print | Print What: Entire Workbook | Preview
but when i choose "Entire Workbook", the Preview button is dimmed and I
cannot select it.
I've used this method before, and it's worked, but now it doesn't.
When "Acive Sheet(s)" or "Selection" is selected the preview is
undimmed.
Why is this happening?
Hello, I've been searching hundreds of posts but not found an answer to this. I have a procedure that applies lots of formatting, filters, repaginates and then finally opens the print dialogue box with
Application.Dialogs(xlDialogPrint).Show
What I need it to do is disable / grey out the "Entire workbook" button so that my users can only print out the active sheet. It defaults to active sheet but I just know that someone will change it and get a lot of wasted paper.
According to the help files and other posts, the 'Print what' section is governed by argument 7 but I don't know if this is where to disable an option or what value to pass to do this.
Another option would be to get my procedure to run across all the sheets but this would take quite a bit of time (takes about 30s for one sheet) and the users would think something was wrong even if I popped up a message box telling them it would take a while.
Any guidance on this would be greatly appreciated
Thanks
John
|
|