472,133 Members | 1,162 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,133 software developers and data experts.

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 15136
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.