How to save as a new file extension using the same current filename in VBA macro

This is how you can save as a new file with a different file extension but the you would like to use back the same file name as the current file you are saving from. This is a VBA macro code for Ms Excel, Ms Project or any other Ms Office product that uses VBA macro for automation.

By using the object "ThisProject.Name", assign it to a variable and use the variable in the "FileSaveAs" command file path parameter.

Example:

Dim FileName As String
FileName = ThisProject.Name
FileSaveAs Name:="\path" & FileName & ".csv", FormatID:="MSProject.CSV", map:="exportCSV_map"


Comments

Popular posts from this blog