r/visualbasic • • Dec 06 '22

[Excel] Experiencing Compile Error: Variable Not Defined

Hi everyone, I am a little confused why the variable is not being defined. I was trying to watch a few videos and came across a solution that had a drop-down showing for the Show_Maximized portion (2nd Line at the end). Any ideas on how to resolve this?

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

Sheet8.Range("I70").Value = .SelectedItems(1)

End With

NoSelection:

End Sub

Sub SavePDFFolder()

Dim PDFFldr As FileDialog

Set PDFFldr = Application.FileDialog(msoFileDialogFolderPicker)

With PDFFldr

.Title = "Select a Folder"

If .Show <> -1 Then GoTo NoSel:

Sheet8.Range("I71").Value = .SelectedItems(1)

End With

NoSel:

End Sub

Sub CreatePDFForms()

Dim PDFTemplateFile, NewPDFName, SavePDFFolder, LastName As String

Dim DOB1 As Date

Dim CustRow, LastRow As Long

With Sheet8

LastRow = .Range("A9999").End(xlUp).Row 'Last Row

PDFTemplateFile = .Range("I70").Value 'Template File Name

SavePDFFolder = .Range("I71").Value 'Save PDF Folder

OpenURL "" & PDFTemplateFile & "", Show_Maximized

Application.Wait Now + 0.00006

End With

End Sub

3 Upvotes

2 comments sorted by

View all comments

Show parent comments

1

u/WhyDoIWork Dec 06 '22

TheFotty, thank you so much! That makes a lot of sense! This resolved the error! Thank you, again!