Hi all,
I'm hoping someone can assist, I've been trying to put together some code from what i've found on here but to no joy.
I'm trying to get some code that will save on a push button to both PDF and Excel macroenabled file at the same time, but prompt to ask where to save it (save as) and to save it from a certain cell for its file name. also for it to check that the file does not already exist.
I'm also curious if there is something that can save to a specific folder depending on month, i.e if I have a folder 2021, and have folders with the months in, that the code would be able to place it in the correct month folder when saving, i'll be honest this isnt important... I was just curious .
Thanks in advance.
My very poor attempt of bodging someone elses code... please dont judge me lol :
Private Sub CommandButton1_Click()
'
' save Macro
Dim fil As Variant
fil = Application.GetSaveAsFilename(fileFilter:="microsoft excel files (*.xls), *.xls")
If fil <> False Then
MsgBox "File Saved as " & fil
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=Range("m10").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End If
End Sub
I'm hoping someone can assist, I've been trying to put together some code from what i've found on here but to no joy.
I'm trying to get some code that will save on a push button to both PDF and Excel macroenabled file at the same time, but prompt to ask where to save it (save as) and to save it from a certain cell for its file name. also for it to check that the file does not already exist.
I'm also curious if there is something that can save to a specific folder depending on month, i.e if I have a folder 2021, and have folders with the months in, that the code would be able to place it in the correct month folder when saving, i'll be honest this isnt important... I was just curious .
Thanks in advance.
My very poor attempt of bodging someone elses code... please dont judge me lol :
Private Sub CommandButton1_Click()
'
' save Macro
Dim fil As Variant
fil = Application.GetSaveAsFilename(fileFilter:="microsoft excel files (*.xls), *.xls")
If fil <> False Then
MsgBox "File Saved as " & fil
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=Range("m10").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End If