Hi.
I got this code (below), that users submitt some text and values, then it saves the file as a .pdf.
This works perfect, but, at the line ***foldername = .SelectedItems(1)*** it opens filebox and lets users select a folder to save the pdf file at, but is there a way to show the existing pdf's located in the folder the user selects?
Lets say i open folder Test, and in that folder, there is a 1.pdf and 2.pdf, when the user chooses the test folder, it will also show those files.
With my code, when they open the test folder, its blank, so if they are going to save the file incrementaly to the number, its hard to see what the last number.pdf was.
Thanks in advance
I got this code (below), that users submitt some text and values, then it saves the file as a .pdf.
This works perfect, but, at the line ***foldername = .SelectedItems(1)*** it opens filebox and lets users select a folder to save the pdf file at, but is there a way to show the existing pdf's located in the folder the user selects?
Lets say i open folder Test, and in that folder, there is a 1.pdf and 2.pdf, when the user chooses the test folder, it will also show those files.
With my code, when they open the test folder, its blank, so if they are going to save the file incrementaly to the number, its hard to see what the last number.pdf was.
Code:
ActiveWorkbook.ActiveSheet.Range("AN1").Value = (ComboBox1.Value)
If ComboBox1.Text = "" Then
MsgBox "Please choose a profile name!"
Exit Sub
Else
' Code if not empty
End If
With flder
.Title = "Select the folder containing data"
.AllowMultiSelect = True
If .Show = 0 Then GoTo NextCode
foldername = .SelectedItems(1)
Path = foldername & "\"
If CheckBox2.Value = True And CheckBox1.Value = True Then
FileName1 = TextBox1.Text & " - " & "Dummy - " & "Bromm - " & ActiveWorkbook.ActiveSheet.Range("AN1").Value
ActiveWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path & FileName1 & ".pdf", OpenAfterPublish:=False
Else
If CheckBox2.Value = True Then
FileName1 = TextBox1.Text & " - " & "Dummy - " & ActiveWorkbook.ActiveSheet.Range("AN1").Value
ActiveWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path & FileName1 & ".pdf", OpenAfterPublish:=False
Else
If CheckBox1.Value = True Then
FileName1 = TextBox1.Text & " - " & "Bromm - " & ActiveWorkbook.ActiveSheet.Range("AN1").Value
ActiveWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path & FileName1 & ".pdf", OpenAfterPublish:=False
Else
FileName1 = TextBox1.Text & " - " & ActiveWorkbook.ActiveSheet.Range("AN1").Value
ActiveWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path & FileName1 & ".pdf", OpenAfterPublish:=False
End If
End If
End If
End With
Set flder = Nothing
MsgBox "File Saved to " & FileName1, vbInformation, "Saved File"
Unload Me
NextCode:
Exit Sub