Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default How do I modify this macro to print the currently visible chart?

Okay, I've created a macro to print "Chart 1" in my worksheet. The code is as
follows:

Sub PrintChart()
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.ShowWindow = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

However, my worksheet has 45 charts in it and I want to be able to print the
chart I am viewing at the time. Each chart is located in its own area of the
worksheet so that they are the only ones visible at any one time. At present
I have a menu structure with hyperlinks to each of the charts and, at the
bottom of each chart, a macro button to return me back to the menu. I want to
add a second macro button so that users can print the chart that's currently
visible on the screen?

How do I modify the above code to achieve this?

Many thanks,

Joe.
--
If you can measure it, you can improve it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default How do I modify this macro to print the currently visible chart?

hi Joe,
you could use ActiveWindow.VisibleRange.PrintOut
that prints everything visible
if you want to print only the chartobject:

For Each cht In ActiveSheet.ChartObjects
If Not Intersect(cht.TopLeftCell, _
ActiveWindow.VisibleRange) Is Nothing Then
cht.Chart.PrintOut
End If
Next

stefan
On 22 Mai, 08:56, Monomeeth
wrote:
Okay, I've created a macro to print "Chart 1" in my worksheet. The code is as
follows:

Sub PrintChart()
* * ActiveSheet.ChartObjects("Chart 1").Activate
* * ActiveChart.PlotArea.Select
* * ActiveChart.ShowWindow = True
* * ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

However, my worksheet has 45 charts in it and I want to be able to print the
chart I am viewing at the time. Each chart is located in its own area of the
worksheet so that they are the only ones visible at any one time. At present
I have a menu structure with hyperlinks to each of the charts and, at the
bottom of each chart, a macro button to return me back to the menu. I want to
add a second macro button so that users can print the chart that's currently
visible on the screen?

How do I modify the above code to achieve this?

Many thanks,

Joe.
--
If you can measure it, you can improve it!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Visible Sheets Macro Lisa C. Excel Discussion (Misc queries) 1 April 6th 09 06:08 AM
How to write a macro to modify an Excel chart raymondvillain Charts and Charting in Excel 4 July 14th 07 04:38 PM
How can I print a chart with visible grid lines? Todd Excel Discussion (Misc queries) 1 April 19th 07 03:27 PM
Modify Print Macro,,, is it possible. Newbeetle Excel Programming 5 February 18th 07 04:53 PM
Need Help w/ Print Macro to Print All Visible Sheets (including Charts) in a Workbook will Excel Programming 3 September 23rd 04 08:05 PM


All times are GMT +1. The time now is 03:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"