473,226 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 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 15361
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ganesh Kolappan via .NET 247 | last post by:
Hi I am trying to populate a <asp:dropdownlist> in a XSLT file withdatasource pointing to a C# codebehind file method which returnsa dataview. I am using XSLT extension object. But I am...
1
by: D. Yates | last post by:
Hi, I am looking for an example of how to extract bitmap images from an embedded resource file (a file with *.res extension, which can be viewed inside of the ide and can hold bitmaps, icons,...
5
by: meeeeeeeeeep | last post by:
i use: fiFileInfo.CopyTo(Path.ChangeExtension(fiFileInfo.FullName + fiFileInfo.Extension, ".enc"), false); to rename a file (eg: crap.ppt -> crap.ppt.enc). if the file is really big (400mb),...
1
by: news.microsoft.com | last post by:
Hello, I want to get a list of file types from a big list of extensions. I know there exists an api call (see below), but it only works when you have a file name. SHGetFileInfo(FileName, 0,...
3
by: Phoe6 | last post by:
Hi all, I had a filesystem crash and when I retrieved the data back the files had random names without extension. I decided to write a script to determine the file extension and create a newfile...
1
by: jfmarto | last post by:
Hi, I'm doing a program with VS.2005 and compact framework 2.0. How can i define which program opens automatically a file (with a specific extension). Thanks
2
by: ahynes | last post by:
HI folks, I'm a chem engineer with no VB programming knowledge (as you'll see from my question!) I want a script to open a .txt file, insert pre-defined text into the start and end of the...
2
by: shapper | last post by:
Hello, I want to make a file available to a user for download on an ASP.NET page. So I need to have a button that when clicked, the file is download. However, before the file is downloaded, I...
1
by: mwcapps | last post by:
I'm writing an import application that import .csv files into my SQL Server 2005 database. When the import is complete I need to change that files extension from .csv to .imp with the same path. ...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.