ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A little help with SaveAs Method please (https://www.excelbanter.com/excel-programming/328471-little-help-saveas-method-please.html)

Stitch45

A little help with SaveAs Method please
 
I have a VBA macro that opens a selected CSV file and executes. What is the
code required to make the macro save the CSV file as an Excel Workbook, with
the same name and in the same location?

Appreciate the help

thanks



Doug Glancy

A little help with SaveAs Method please
 
Stitch,

Using the macro recorder and then modifying, I got this. It assumes the
book your saving is the activeworkbook:

Sub Test()
ActiveWorkbook.SaveAs Filename:= _
Replace(LCase(ActiveWorkbook.Name), "csv", "xls"), FileFormat:=xlNormal
_
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
End Sub

hth,

Doug

"Stitch45" wrote in message
...
I have a VBA macro that opens a selected CSV file and executes. What is
the code required to make the macro save the CSV file as an Excel Workbook,
with the same name and in the same location?

Appreciate the help

thanks





All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com