macro to save .csv in excel 2007 .xlsx format

M

Martin

Hi everybody,

I am putting together a macro that requires saving a .csv spreadsheet to
Excel format (.xlsx).

The file has always the same structure but the name changes according to the
date (it's a download from a customer Portal).

The code for this section looks like this:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and
Settings\x132476\Desktop\PCIMerchantReport-20100407.xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

Is there a way to save it without refering to the actual filename?

Any help is appreciated...

Martin
 
D

Doug Robbins - Word MVP

You are in the wrong forum as this one is for Word.

However, the code that you need is:

With ActiveWorkbook
.SaveAs Left(.FullName, InStr(.FullName, ".")) & "xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
Joined
May 1, 2015
Messages
1
Reaction score
0
Wow Doug Robbins this may be the wrong place, but it is the first place I found a real answer.
 

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

Top