Reputation: 131
I am looking for a macro to save a currently open XLSM file as something other than the XLSM file with the below conditions.
I want to be able to save the file as any name.
I want to be able to save the file as any format.
I want to be able to choose the directory where it is save.
So basically I want to be able to save the file just like I would do a normal Save As file without using a macro.
I have seen a number of different macros out there that do parts of my request but nothing with all the conditions.
Upvotes: 1
Views: 204
Reputation: 14537
Using FileDialog :
Sub Example1()
Dim intChoice As Integer
Dim strPath As String
'make the file dialog visible to the user
intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
'determine what choice the user made
If intChoice <> 0 Then
'get the file path selected by the user
strPath = _
Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
'displays the result in a message box
Call MsgBox(strPath, vbInformation, "Save Path")
End If
End Sub
To use SaveAs
, take a look : http://www.rondebruin.nl/win/s5/win001.htm and https://msdn.microsoft.com/fr-fr/library/office/ff841185.aspx
Upvotes: 1