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

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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