VBA Question

cesymcox101

New Member
Joined
Jan 11, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have inherited a macro-based file that has a radial button to convert the active sheet to a pdf. the issue is that it keeps debugging out on the saveaspdf macro. the code is listed below.

Worksheets(selectsheets()).Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=ThisWorkbook.Path & "\" & Worksheets("Update Data").Range("D22") & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True

1673477473885.png


Welcome any solutions.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Can't tell from that which line causes the error. Try stepping through the code & checking variable values after the line is executed. Or substitute values for variables such as file path. Check that arrays have elements and are not empty, or that in a loop you're not going higher than the number of array elements, especially if the array is zero based.

Better to post code within code tags, using vba icon on posting toolbar rather than posting pics. Hard to read.
 
Upvote 0

Forum statistics

Threads
1,215,491
Messages
6,125,102
Members
449,205
Latest member
ralemanygarcia

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