Save As active PDF file with a different name

hearthhrob4gals

Board Regular
Joined
Aug 20, 2014
Messages
142
Hi All,

I've a PDF file. I'm opening it through the below code. Before closing it, I wish to rename/Saveas the file with a different name (Lets say 'ABC.PDF). Can anyone help.

Code:
Dim lMyNewNum As Long
    Dim strTest As String


    Dim XLName As String, PDFPath As String, READERPath As String
    Dim OpenPDF, sh As Worksheet
    Dim sSourcePath As String
    Dim sDestinationPath As String
    Dim objFolder, objFile, objFSO, FldrPicker, myPath, myExtension, myfile
    Dim a, S, B, strDest, strSource
    Set objFSO = CreateObject("scripting.filesystemobject")
   
    XLName = ThisWorkbook.Name


    
    
    Set FldrPicker = Application.FileDialog(msoFileDialogFolderPicker)


    With FldrPicker
      .Title = "Select A Target Folder"
      .AllowMultiSelect = False
        If .Show <> -1 Then GoTo NextCode
        myPath = .SelectedItems(1) & "\"
    End With
    
'In Case of Cancel
NextCode:
  myPath = myPath
  Set objFolder = objFSO.GetFolder(myPath)




  myExtension = "*.pdf"
  myfile = Dir(myPath & myExtension)
 


  For Each objFile In objFolder.Files
  
    FlName = objFile.Name
   


    ActiveWorkbook.FollowHyperlink (objFile)
    
    Application.Wait Now + TimeValue("00:00:02")


    SendKeys "^a", True
    Application.Wait Now + TimeValue("00:00:02")


    SendKeys "^c"
    Application.Wait Now + TimeValue("00:00:03")


    'Windows(XLName).Activate
'    Sheets("sheet1").Select
    ThisWorkbook.Sheets("Raw Data").Select
    Range("A1").Select
    ActiveSheet.Paste

PDFCLOSE
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

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