467,151 Members | 955 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

rename the filename thru vb

hi everybody,

iam using the following code for open the file.

sfil = d:\abc.txt

nSourceFile = FreeFile
Open sfil For Input As #nSourceFile

now i want 2 change the extension of the opened file to .bak. ie the original file wants 2 rename.



can any one help me regarding this isssue

regards

vivek
Nov 8 '06 #1
  • viewed: 1368
Share:
5 Replies
1GB
hi everybody,

iam using the following code for open the file.

sfil = d:\abc.txt

nSourceFile = FreeFile
Open sfil For Input As #nSourceFile

now i want 2 change the extension of the opened file to .bak. ie the original file wants 2 rename.



can any one help me regarding this isssue

regards

vivek
If you take a look at the file object which is part of the filesystemobject collection you will see that you can change the filename
Nov 8 '06 #2
Name old name and path As new name and path
hope this helps
Nov 8 '06 #3
That doesn't work with files that need to be overwritten.
An error saying that the file already exists pops up.
Feb 11 '07 #4
Expert 8TB
That doesn't work with files that need to be overwritten.
An error saying that the file already exists pops up.
Perhaps so, but that wasn't part of the original question.

Also, it's worth noting that while statements such as Name As are quick and simple to code, the FileSystem Object gives you much more power and control over the file system.
Feb 12 '07 #5
balid
Perhaps so, but that wasn't part of the original question.

Also, it's worth noting that while statements such as Name As are quick and simple to code, the FileSystem Object gives you much more power and control over the file system.

Plus you can override the warning message this way as well.
Feb 12 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Merlin | last post: by
3 posts views Thread by Yannick Benoit | last post: by
4 posts views Thread by Dynamo | last post: by
6 posts views Thread by shuaishuaiyes@sina.com | last post: by
5 posts views Thread by mythili123 | last post: by
3 posts views Thread by Cirene | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.