Remove extension

S

Stanley Lam

Hello,

First of all - sorry for my bad english!

I have written a macro in Excel that does the following things:
* the data on the sheet is copied to another workbook and this workbook
is saved as a *.prn file
* then the new workbook will be closed

Is it possible to remove the prn-extention after I have saved and closed
it?



Stanley
 
B

Bob Phillips

Hi Stanley,

Why do you want to do this? Are you referring to the file on the disk, and
do you want to change the file type?
 
S

Stanley Lam

Bob,

Thanks for your reaction!

The file that has been made, I have to upload it to another application.
But in order to make this work, there are 2 things that has to been done
before uploading it:
1. the file has to be saved as a *.prn
2. the extension has to be removed

So the type of file is created by my macro (*.prn), but the final step
removing the extension still has to be made.



Stanley
 
B

Bob Phillips

Hi Stanley,

This should get you started

Dim sFile As String

sFile = "C:\myTest\Test.prn"
Name sFile As Replace(sFile, ".prn", "")
 
T

Tom Ogilvy

If it is created by your macro, why not assign it a name with the extension
you want and just avoid the need to rename it.
 
S

Stanley Lam

Bob,

you're my hero! With that code I can remove the extension.


Many thanks,
Stanley
 

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