Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bnelson111
Creator
Creator

Macro to Select two Charts and Export to PNG.

Everyone,

I have a Macro that is working to export one chart to a png file. I wish to select and export two charts to make one png. Any help gratefully appreciated.

Macro that is working for one chart 78, i wish to see chart 78 and chart 77 on the one png?

Sub ExportToPng()

ActiveDocument.GetSheetByID("SH17").Activate

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.GetSheetObject("CH78").ExportBitmapToFile "c:\dashboard.png"

End Sub

Thanks in advance Brett

26 Replies
hector_munoz
Specialist
Specialist

Hi Brett,

I am afraid that is not possible directly... I have tried to create a container and to put in 2 charts and later "print" it but it does not work... You could try trellis (if graph is a bars on) or grid (if graph is a pie one)...

Regards,

H

bnelson111
Creator
Creator
Author

I have got container to work.

sarvesh
Creator III
Creator III

Sub ExportToPng()

ActiveDocument.GetSheetByID("SH17", "id of 2nd sheet").Activate

ActiveDocument.GetApplication.WaitForIdle

ActiveDocument.GetSheetObject("CH78").ExportBitmapToFile "c:\dashboard1.png"

ActiveDocument.GetSheetObject("CH77").ExportBitmapToFile "c:\dashboard2.png"

End Sub



Note: You can't create both sheet in single png file but pdf is possible.



Please remember to mark this as "helpful" & "correct answer" if your query has been solved.

This will help users identify the answers should they come across this thread in the future.


Regard's

Sarvesh Srivastava



bnelson111
Creator
Creator
Author

Thankyou for reply, Is it possible to have CH78 and CH77 on "c:\dashboard1.png". I was trying to see if there was away to select the two charts at one time then .ExportBitmapToFile "c:\dashboard1.png"

sarvesh
Creator III
Creator III

No this is not possible, i have told you earlier.

bnelson111
Creator
Creator
Author

You mentioned PDF is possible?

sarvesh
Creator III
Creator III

please read it carefully..

Anil_Babu_Samineni

Recently, I mean 5 days the conversation is running up the same case

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
bnelson111
Creator
Creator
Author

Just read the posts. Yes i see the difficultly in the two objects to image and understand the container works. Even if i could get the charts into power point that would be great. but need the spacing and layout to be the same and fit the power point or pdf