hello all,
New to this, found a random tutorial online, tried to alter it do it be useful to me. Im getting error mentioned in title. Please advise
Option Explicit
Sub PDFTemplate()
Dim PDffldr As FileDialog
Set PDffldr = Application.FileDialog(msoFileDialogFilePicker)
With PDffldr
.Title = "Select PDF file to attach"
.Filters.Add "PDF Type Files", "*.pdf", 1
If .Show <> -1 Then GoTo NoSelection
Sheet1.Range("J2").Value = .SelectedItems(1)
End With
NoSelection:
End Sub
Sub SavePDFWT()
Dim PDffldr As FileDialog
Set PDffldr = Application.FileDialog(msoFileDialogFilePicker)
With PDffldr
.Title = "Select File for W/T"
If .Show <> -1 Then GoTo NoSel:
Sheet1.Range("J5").Value = .SelectedItems(1)
End With
NoSel:
End Sub
Sub SavePDFFolder()
Dim PDffldr As FileDialog
Set PDffldr = Application.FileDialog(msoFileDialogFolderPicker)
With PDffldr
.Title = "Select Folder"
If .Show <> -1 Then GoTo NoSel:
Sheet1.Range("J8").Value = .SelectedItems(1)
End With
NoSel:
End Sub
Sub CreatePdFForms()
Dim PDFTemplateFile As String
Dim NewPDFName As String
Dim SavePDFFolder As String
Dim SavePDFWT As String
Dim JCN As String
Dim ACFTNUM As String
Dim CustRow, LastRow As Long
With Sheet1
LastRow = .Range("A9999").End(xlUp).Row
PDFTemplateFile = .Range("J2").Value
SavePDFWT = .Range("J5").Value
SavePDFFolder = .Range("J8").Value
ThisWorkbook.FollowHyperlink Address:=.Range("J2").Value, NewWindow:=False, AddHistory:=True
Application.Wait Now + 0.00006
For CustRow = 2 To 2
JCN = .Range("A" & CustRow).Value
ACFTNUM = .Range("C" & CustRow).Value
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("B" & CustRow).Value, True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("C" & CustRow).Value, True
Application.Wait Now + 0.00003
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys JCN, True
Application.Wait Now + 0.00002
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("D" & CustRow).Value
Application.Wait Now + 0.00002
If .Range("F" & CustRow).Value <> "" Then
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("F" & CustRow).Value
Application.Wait Now + 0.00003
End If
ThisWorkbook.FollowHyperlink Address:=.Range("J5").Value, NewWindow:=False, AddHistory:=True
Application.Wait Now + 0.00006
Application.SendKeys "{tab}", True
Application.SendKeys .Range("A" & CustRow).Value
Application.Wait Now + 0.00002
Application.SendKeys "{tab}", True
Application.Wait Now + 0.00002
Application.SendKeys "^+(s)", True
Application.SendKeys "%", True
Application.Wait Now + 0.00002
Application.SendKeys SavePDFFolder & "" & JCN & ".pdf"
Application.Wait Now + 0.00002
Application.SendKeys "%(s)", True
Application.Wait Now + 0.00002
Next CustRow
Application.SendKeys "^(q)", True
Application.SendKeys "{numlock}%(s)", True
End With
End Sub
New to this, found a random tutorial online, tried to alter it do it be useful to me. Im getting error mentioned in title. Please advise
Option Explicit
Sub PDFTemplate()
Dim PDffldr As FileDialog
Set PDffldr = Application.FileDialog(msoFileDialogFilePicker)
With PDffldr
.Title = "Select PDF file to attach"
.Filters.Add "PDF Type Files", "*.pdf", 1
If .Show <> -1 Then GoTo NoSelection
Sheet1.Range("J2").Value = .SelectedItems(1)
End With
NoSelection:
End Sub
Sub SavePDFWT()
Dim PDffldr As FileDialog
Set PDffldr = Application.FileDialog(msoFileDialogFilePicker)
With PDffldr
.Title = "Select File for W/T"
If .Show <> -1 Then GoTo NoSel:
Sheet1.Range("J5").Value = .SelectedItems(1)
End With
NoSel:
End Sub
Sub SavePDFFolder()
Dim PDffldr As FileDialog
Set PDffldr = Application.FileDialog(msoFileDialogFolderPicker)
With PDffldr
.Title = "Select Folder"
If .Show <> -1 Then GoTo NoSel:
Sheet1.Range("J8").Value = .SelectedItems(1)
End With
NoSel:
End Sub
Sub CreatePdFForms()
Dim PDFTemplateFile As String
Dim NewPDFName As String
Dim SavePDFFolder As String
Dim SavePDFWT As String
Dim JCN As String
Dim ACFTNUM As String
Dim CustRow, LastRow As Long
With Sheet1
LastRow = .Range("A9999").End(xlUp).Row
PDFTemplateFile = .Range("J2").Value
SavePDFWT = .Range("J5").Value
SavePDFFolder = .Range("J8").Value
ThisWorkbook.FollowHyperlink Address:=.Range("J2").Value, NewWindow:=False, AddHistory:=True
Application.Wait Now + 0.00006
For CustRow = 2 To 2
JCN = .Range("A" & CustRow).Value
ACFTNUM = .Range("C" & CustRow).Value
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("B" & CustRow).Value, True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("C" & CustRow).Value, True
Application.Wait Now + 0.00003
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys JCN, True
Application.Wait Now + 0.00002
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("D" & CustRow).Value
Application.Wait Now + 0.00002
If .Range("F" & CustRow).Value <> "" Then
Application.SendKeys "{tab}", True
Application.SendKeys "{tab}", True
Application.SendKeys .Range("F" & CustRow).Value
Application.Wait Now + 0.00003
End If
ThisWorkbook.FollowHyperlink Address:=.Range("J5").Value, NewWindow:=False, AddHistory:=True
Application.Wait Now + 0.00006
Application.SendKeys "{tab}", True
Application.SendKeys .Range("A" & CustRow).Value
Application.Wait Now + 0.00002
Application.SendKeys "{tab}", True
Application.Wait Now + 0.00002
Application.SendKeys "^+(s)", True
Application.SendKeys "%", True
Application.Wait Now + 0.00002
Application.SendKeys SavePDFFolder & "" & JCN & ".pdf"
Application.Wait Now + 0.00002
Application.SendKeys "%(s)", True
Application.Wait Now + 0.00002
Next CustRow
Application.SendKeys "^(q)", True
Application.SendKeys "{numlock}%(s)", True
End With
End Sub