My auto-save code isnt working!

LyndsRose

New Member
Joined
Aug 21, 2019
Messages
1
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 "%(n)", 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
 

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,879
Messages
6,175,148
Members
452,615
Latest member
bogeys2birdies

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