A little help with SaveAs Method please

S

Stitch45

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
 
D

Doug Glancy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top