Remove extension

  • Thread starter Thread starter Stanley Lam
  • Start date Start date
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
 
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?
 
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
 
Hi Stanley,

This should get you started

Dim sFile As String

sFile = "C:\myTest\Test.prn"
Name sFile As Replace(sFile, ".prn", "")
 
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.
 
Bob,

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


Many thanks,
Stanley
 
Back
Top