I am not sure why the code for applicationsaveas didn't work for CSV so I added a slight modification for that section. I also changed it up so that there is no option for yes or no anymore but instead it will save in the appropriate formate based on which sheet name you are on as you mentioned they are exported from different sheets. No it was not complicated at all. Try this.
Sub File_OptionExportPDF_CSV()
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
If ActiveSheet.Name = "(4) Google Calendar input" Then
CSVName = ActiveSheet.Range("T1")
ChDir "C:\" 'This is where you set a default file path.
filesavename = Application.GetSaveAsFilename("Hansons Marathon Method - Training Calendar", _
fileFilter:="PDF Files (*.PDF), *.PDF")
If filesavename <> False Then
ActiveSheet.ExportAsFixedFormat Type:=xlPDF, Filename:= _
filesavename _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End If
End If
If ActiveSheet.Name = "(3) Google Calendar Setup" Then
PDFName = ActiveSheet.Range("T1")
ChDir "C:\" 'This is where you set a default file path.
filesavename = Application.GetSaveAsFilename("Hansons Marathon Method - Training Calendar", _
fileFilter:="CSV Files (*.CSV), *.CSV")
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:= _
"" & filesavename & "" _
, FileFormat:=xlCSV, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Application.DisplayAlerts = True
End If
MsgBox "File Saved to" & " " & filesavename
End Sub
Bookmarks