Help with VBA

inspectorNDT

New Member
Joined
May 10, 2019
Messages
16
I am really new to VBA's. I am trying to make a "create PDF" button to make a PDF out of the active tab. The file name would be using cells on the active tab then the name of the tab and then another cell.

I would also like it to prompt the user if a file of the same name exist and I would like it to auto save to the active users desktop.

thank you in advance for your help
 
.
What line in the macro code is highlighted yellow when you receive the run time error ?
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Private Sub CommandButton1_Click()

IS the code attached to a CommandButton ???
If so, yes !...but the code you posted originally didn't show that.

The revised code that both @Logit and I posted added a Backslash after Desktop !!
As mentioned earlier, did you make sure that the cells refering to the filename are correct and DO NOT contain any illegal characters.

I might add that the code works fine for me !!
 
Upvote 0
just above the code entry space. Does the drop down need to be (general), Comandbutton1 or worksheet? Also do i nee to select anything on the left side?
 
Upvote 0
If you Rclick on the command button and select assign macro it will take you to the correct window to paste the code
 
Upvote 0
I would like the code attached to the command button per my first post.

also when i try to run the code now the Private Sub CommandButton1_Click() is highlighted.



IS the code attached to a CommandButton ???
If so, yes !...but the code you posted originally didn't show that.

The revised code that both @Logit and I posted added a Backslash after Desktop !!
As mentioned earlier, did you make sure that the cells refering to the filename are correct and DO NOT contain any illegal characters.

I might add that the code works fine for me !!
 
Upvote 0
.
Type END SUB at the bottom of all your lines of code.
 
Upvote 0

Forum statistics

Threads
1,224,945
Messages
6,181,935
Members
453,074
Latest member
JefersonKollet

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