changing a Word doc to Excel

B

Bob

I have a macro that allows a user to pick Word document
file from a list(as a text file), formats the columns and
adds a header then saves the file as an Excel document.
The file opens in one drive and saves in another.

The problem I have is that the file still has the .doc in
the filename and saves as a .doc file not Excel (even if
Microsoft office Excel Workbook is used as in

filesavename = Application.GetSaveAsFilename( _
fileFilter:="microsoft office excel workbook Files
(*.xls), *.xls")
How do I take out the .doc from the filename?
This is done in Excel 2003.
 
M

Melanie Breden

Hi Bob,
I have a macro that allows a user to pick Word document
file from a list(as a text file), formats the columns and
adds a header then saves the file as an Excel document.
The file opens in one drive and saves in another.

The problem I have is that the file still has the .doc in
the filename and saves as a .doc file not Excel (even if
Microsoft office Excel Workbook is used as in

filesavename = Application.GetSaveAsFilename( _
fileFilter:="microsoft office excel workbook Files
(*.xls), *.xls")
How do I take out the .doc from the filename?
This is done in Excel 2003.

replace the string with nothing:

FileSaveName = Application.GetSaveAsFilename( _
InitialFileName:=Replace(ActiveWorkbook.Name, ".doc", ""), _
fileFilter:="microsoft office excel workbook Files(*.xls), *.xls")

--
Regards

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)
 

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