469,306 Members | 1,881 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

How do I rename a file's extension

I found the transfertext function and found that it bombs if I do not use
the extension "txt". But the application I am writing the info for has a
different file extenstion. What VBA command will rename the file once it is
written?
Thanks
Nov 12 '05 #1
4 14577
Name C:\MyFolder\MyFileName.XXX As C:\MyFolder\MyFileName.txt
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Colleyville Alan" <ae***********@nospam.comcast.net> wrote in message
news:t%CQb.144814$na.232923@attbi_s04...
I found the transfertext function and found that it bombs if I do not use
the extension "txt". But the application I am writing the info for has a
different file extenstion. What VBA command will rename the file once it is
written?
Thanks

Nov 12 '05 #2
The Name statement.

Name "C:\File.txt" As "C:\File.dat"

It is possible, by the way, to get around the .txt restriction. See the
following KB articles:
http://support.microsoft.com/?id=245407
http://support.microsoft.com/?id=306144

(While they refer to importing, the same is true for exporting)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"Colleyville Alan" <ae***********@nospam.comcast.net> wrote in message
news:t%CQb.144814$na.232923@attbi_s04...
I found the transfertext function and found that it bombs if I do not use
the extension "txt". But the application I am writing the info for has a
different file extenstion. What VBA command will rename the file once it is written?
Thanks

Nov 12 '05 #3
You forgot the quotes.

Name "C:\MyFolder\MyFileName.XXX" As "C:\MyFolder\MyFileName.txt"

or

Dim strFileOld As String
Dim strFileNew As String

strFileOld = "C:\MyFolder\MyFileName.XXX"
strFileNew = "C:\MyFolder\MyFileName.txt"
Name strFileOld As strFileNew
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)

"PC Datasheet" <sp**@nospam.spam> wrote in message
news:hh***************@newsread3.news.atl.earthlin k.net...
Name C:\MyFolder\MyFileName.XXX As C:\MyFolder\MyFileName.txt
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

"Colleyville Alan" <ae***********@nospam.comcast.net> wrote in message
news:t%CQb.144814$na.232923@attbi_s04...
I found the transfertext function and found that it bombs if I do not use the extension "txt". But the application I am writing the info for has a different file extenstion. What VBA command will rename the file once it is written?
Thanks


Nov 12 '05 #4

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:Xm*********************@news04.bloor.is.net.c able.rogers.com...
You forgot the quotes.

Name "C:\MyFolder\MyFileName.XXX" As "C:\MyFolder\MyFileName.txt"

or

Dim strFileOld As String
Dim strFileNew As String

strFileOld = "C:\MyFolder\MyFileName.XXX"
strFileNew = "C:\MyFolder\MyFileName.txt"
Name strFileOld As strFileNew


Thanks.
But as regards the KB articles, I'll pass on modifying the windows registry.
I am developing this at home but will be showing a demo at work and I dont
want to mess with that registry.
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ganesh Kolappan via .NET 247 | last post: by
1 post views Thread by D. Yates | last post: by
5 posts views Thread by meeeeeeeeeep | last post: by
1 post views Thread by news.microsoft.com | last post: by
2 posts views Thread by shapper | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.