VBA Dynamic Print to PDF

sgosselin

New Member
Joined
Jan 4, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello, I need a bit of help with VBA.
I've been programming in VBA for about a year, and I come here very often to find answers for questions I might have, but this one is stumping me.

I'm developing a product where people in my org can use different templates to create different charts. Each chart that's created is put on a new chart sheet (the type where the chart is the entire page).

What I want is to have a button that will print only the created charts to PDF. I have it currently working, but only if ALL the charts possible are created. Is there a way to have it print to PDF only the ones that have been created?

For example, users have the option to use templates 1, 2, or 3, but if someone only needs to use 1 and 3, I want the "print to PDF" button to publish just those two. Currently it will only work if charts 1, 2, and 3 are all present.

What I'm thinking is when the chart is created, add the name of it to an array, and then have the print to PDF macro print the array? Again I'm kind of a newbie so I'm sure there's a better way to do this.

Thanks!
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
if each chart is created in a sheet then that mean you can choose all the sheets that include chart and export those to pdf, is that true?
 
Upvote 0
Populate a Userform Listbox or combobox with the chart sheet names and when selected, print.
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,165
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top