It did work...beautifully....now it just wont. I tried changing the folder it saves to, updated it on the sheet and saved, and nothing. I played with the wait times as well as my computer is on the slower side. This is my first time coding and i was surprised that everything else worked. There are two other subs before this that are working fine. I double checked my spelling throughout. I have 182 lines of data to turn into PDF forms with this.
I cant find anything wrong with the my SavePDFFolder thats in red italics below. Any help is VERY appreciated!
Sub CreatePDFForms()
Dim PDFTemplateFile, NewPDFName, SavePDFFolder, SerialNumber As String
Dim PartRow As DataLabel
Dim PNRow, LastRow As Long
With Sheet1
LastRow = .Range("A9999").End(xlUp).Row 'Last Row
PDFTemplateFile = .Range("B186").Value 'Template File Name
SavePDFFolder = .Range("B188").Value 'Save PDF Folder
ThisWorkbook.FollowHyperlink "C:\Users\lynds\OneDrive - 626\Documents\1. ISO\Warehouses\Inventory Receiving Form.pdf"
Application.Wait Now + 0.00005
For PNRow = 7 To 7 'LastRow
PartNumber = .Range("A" & PNRow).Value 'Part Number
SerialNumber = .Range("B" & PNRow).Value 'Serial Number
OEM = .Range("C" & PNRow).Value 'OEM
Description = .Range("D" & PNRow).Value 'Description
Application.SendKeys "{Tab}", True
Application.SendKeys Range("A" & PNRow).Value, True 'Part Number
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys Range("B" & PNRow).Value, True 'Serial Number
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys Range("C" & PNRow).Value, True 'OEM
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("D" & PNRow).Value, True 'Description
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("E" & PNRow).Value, True 'Status
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("F" & PNRow).Value, True 'Location
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("G" & PNRow).Value, True 'Shelf
Application.Wait Now + 0.00003
Application.SendKeys "{Tab}", True
Application.SendKeys Range("H" & PNRow).Value, True 'Bin
Application.Wait Now + 0.00003
Application.SendKeys "^(p)", True
Application.Wait Now + 0.00003
Application.SendKeys "{Enter}", True
Application.Wait Now + 0.00003
Application.SendKeys "%", True
Application.Wait Now + 0.00004
Application.SendKeys SavePDFFolder & SerialNumber & "_" & Description & ".pdf"
Application.Wait Now + 0.00003
Application.SendKeys "%(s)", True
Application.Wait Now + 0.00005
Set pApp = CreateObject("AcroExch.App")
pApp.getActiveDoc.Close True
Set pApp = Nothing
Next PNRow
End With
End Sub
I cant find anything wrong with the my SavePDFFolder thats in red italics below. Any help is VERY appreciated!
Sub CreatePDFForms()
Dim PDFTemplateFile, NewPDFName, SavePDFFolder, SerialNumber As String
Dim PartRow As DataLabel
Dim PNRow, LastRow As Long
With Sheet1
LastRow = .Range("A9999").End(xlUp).Row 'Last Row
PDFTemplateFile = .Range("B186").Value 'Template File Name
SavePDFFolder = .Range("B188").Value 'Save PDF Folder
ThisWorkbook.FollowHyperlink "C:\Users\lynds\OneDrive - 626\Documents\1. ISO\Warehouses\Inventory Receiving Form.pdf"
Application.Wait Now + 0.00005
For PNRow = 7 To 7 'LastRow
PartNumber = .Range("A" & PNRow).Value 'Part Number
SerialNumber = .Range("B" & PNRow).Value 'Serial Number
OEM = .Range("C" & PNRow).Value 'OEM
Description = .Range("D" & PNRow).Value 'Description
Application.SendKeys "{Tab}", True
Application.SendKeys Range("A" & PNRow).Value, True 'Part Number
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys Range("B" & PNRow).Value, True 'Serial Number
Application.Wait Now + 0.00001
Application.SendKeys "{Tab}", True
Application.SendKeys Range("C" & PNRow).Value, True 'OEM
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("D" & PNRow).Value, True 'Description
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("E" & PNRow).Value, True 'Status
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("F" & PNRow).Value, True 'Location
Application.Wait Now + 0.00002
Application.SendKeys "{Tab}", True
Application.SendKeys Range("G" & PNRow).Value, True 'Shelf
Application.Wait Now + 0.00003
Application.SendKeys "{Tab}", True
Application.SendKeys Range("H" & PNRow).Value, True 'Bin
Application.Wait Now + 0.00003
Application.SendKeys "^(p)", True
Application.Wait Now + 0.00003
Application.SendKeys "{Enter}", True
Application.Wait Now + 0.00003
Application.SendKeys "%", True
Application.Wait Now + 0.00004
Application.SendKeys SavePDFFolder & SerialNumber & "_" & Description & ".pdf"
Application.Wait Now + 0.00003
Application.SendKeys "%(s)", True
Application.Wait Now + 0.00005
Set pApp = CreateObject("AcroExch.App")
pApp.getActiveDoc.Close True
Set pApp = Nothing
Next PNRow
End With
End Sub