Renaming PDFs in VBA

trichmondcpa

New Member
Joined
Jan 28, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Found a lot of examples of how to rename PDFs using VBA. I did a nice detailed code using variables for the old name and then another column would have the new name. Kept getting "file not found error." By process of elimination I started to simplify and hardcode the file path, etc. to see what was the issue. I'm still a little shaky sometimes with VBA.

I eventually got to the point where even the simple command below gives me the file not found error. I even changes a letter in the new name thinking it couldn't overwrite itself.

Any hints or suggestions?

Name "C:\Users\richt\Downloads\1004-2868_001_010822_99R.pdf" As "C:\Users\richt\Downloads\1004-2868_001_010822_99R.pdf"
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi trichmondcpa,

Welcome to MrExcel!!

The code works for me :confused:

If you copy the full path C:\Users\richt\Downloads\1004-2868_001_010822_99R.pdf and paste it into File Explorer does the pdf file open?

Robert
 
Upvote 0

Forum statistics

Threads
1,215,039
Messages
6,122,802
Members
449,095
Latest member
m_smith_solihull

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