Private Sub CommandButton1_Click()
Dim code As String
Dim mtd As String
Dim pdffolder As FileDialog
code = Range("m3").Text
mtd = Range("u7").Text
Set pdffolder = Application.FileDialog(msoFileDialogFolderPicker)
pdffolder.AllowMultiSelect = False
pdffolder.Show
If Range("m3") = "" Then
MsgBox ("Please Enter a Stockist Code")
Else
Dim dir As String
dir = pdffolder.SelectedItems(1)
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=dir & "\" & code & "_" & mtd & ".pdf", openafterpublish:=False
MsgBox ("PDF Generated")
End If
End Sub
Dim code As String
Dim mtd As String
Dim pdffolder As FileDialog
code = Range("m3").Text
mtd = Range("u7").Text
Set pdffolder = Application.FileDialog(msoFileDialogFolderPicker)
pdffolder.AllowMultiSelect = False
pdffolder.Show
If Range("m3") = "" Then
MsgBox ("Please Enter a Stockist Code")
Else
Dim dir As String
dir = pdffolder.SelectedItems(1)
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=dir & "\" & code & "_" & mtd & ".pdf", openafterpublish:=False
MsgBox ("PDF Generated")
End If
End Sub
No comments:
Post a Comment