Hi all,
with the following the VBA should open a "save as" window in Folder G:\Shareplan\test_31686\Plan\07\
The user should choose a subfolder for example G:\Shareplan\test_31686\Plan\07\test123\ to save the file.
The filename should be contrib_per_payroll_check_ & Tag --> for example "contrib_per_payroll_check_170405.
Could you please check what is wrong in my code?
Private Sub Workbook_Open()
Dim Pfad, Tag
With ActiveDocument
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.InitialFileName = "G:\Shareplan\test_31686\Plan\07\"
If .Show <> -1 Then MsgBox "No folder selected! Exiting sub...": Exit Sub
mydir = .SelectedItems(1)
End With
Pfad = mydir & "\"
Tag = Format("yymmdd")
Application.DisplayAlerts = False
.SaveAs Filename: .Name = contrib_per_payroll_check_ & Tag
Application.DisplayAlerts = True
.Close
End With
End Sub
Kind regards,
Thorsten
Bookmarks