I have the code below to save one worksheet of my workbook, I would like to change some things, one of the things I am trying to change and I am having some issues with this is to add a SaveAsBox in my code. Nowadays when I run the macro automatically save the new worksheet in a specif folder, I do not want to save this way anymore, I would like to run the macro and pops-up the SaveAs box with the suggest name "Savings" and the File Type "Excel Macro-Enabled Workbook" Could you guys help me figure this out?
Dim FolderPath As String, path As String, count As Integer
FolderPath = "C:\Users\luuke\Desktop"
path = FolderPath & "\*.xlsx"
Filename = Dir(path)
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Sheets("Savings").Select
Sheets("Savings").Copy
ChDir _
FolderPath
ActiveWorkbook.SaveAs Filename:= _
FolderPath & "\Relatorio_Saving " & count & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Can you try this code
Dim name as Variant
name=Application.GetSaveAsFilename(Relatorio_Saving " & count
& ".xlsx","Excel File
(*.xlsx), *.xlsx")
If name <> "" then
ActiveWorkbook.SaveAs name,xlOpenXMLWorkbook
End If
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.