Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Renaming File Types

Posted on 2006-06-27
4
Medium Priority
?
177 Views
Last Modified: 2011-09-20
Hi Guys.. easy one for y'all..

I have a program that feeds lines of text into a .txt file (C:\update.txt)

the way i have designed it to output the results means if i change the file extension to .bat, it will become a working batch file.  how do i change the extension in vb6?

I do have filesystemobject setup and running :)
0
Comment
Question by:NAORC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 15

Expert Comment

by:cquinn
ID: 16993744
Why not create the file as C:\update.bat in the first place?

0
 
LVL 5

Author Comment

by:NAORC
ID: 16993763
Set m_destTS = m_fso.CreateTextFile("C:\ORCGravity\update.txt", True)

^^throws up errors if i do^^
0
 
LVL 13

Accepted Solution

by:
Mark_FreeSoftware earned 500 total points
ID: 16993827
try this:

dim tmp as string
tmp = "c:\update.txt"
tmp = replace(tmp,".txt",".bat")

now you have "c:\update.bat" in tmp!
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 16993882
"how do i change the extension in vb6?"

In VB6, you can use the Name function to rename a file:

    Dim oldFileName As String
    Dim newFileName As String
   
    oldFileName = "c:\someFile.txt"
    newFileName = "c:\someFile.bat"
   
    Name oldFileName As newFileName
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question