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.
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