|
-
Oct 27th, 2000, 06:08 AM
#1
Thread Starter
Fanatic Member
hi,
i would like to know a way through a button that i can rename a file to another name.
e.g.
system.ini to systemwin.ini, and also detect weather systemwin.ini is present if it is rename a different file
thanks for any help, please could you include some code
Cheers
Merlin ?
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
-
Oct 27th, 2000, 06:21 AM
#2
Code:
Private Sub Command1_Click()
Name "C:\Windows\System.ini" As "C:\Windows\Systemwin.ini"
If Dir("C:\Windows\Systemwin.ini") <> "" Then
Msgbox "File has been renamed!"
Else
Msgbox "An error has occured!", vbCritical, Error$
End If
-
Oct 27th, 2000, 06:24 AM
#3
_______
<?>
Code:
Option Explicit
Private Sub Form_Load()
On Error GoTo errhandle:
Dim sold As String, snew As String
Dim sDir As String
sDir = "C:\my documents\"
sold = sDir & "mytext.txt"
snew = sDir & "smynewfile.txt"
'see if the new file name already exist
If Dir(snew) <> "" Then MsgBox "File Exists Already"
Name sold As snew
errhandle:
'if the file doesn't exist
If Err.Number = 53 Then MsgBox "Sorry, file does not exist."
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 27th, 2000, 06:44 AM
#4
Thread Starter
Fanatic Member
thanks guys that is just what i needed,
Merlin ?
Some people have told me they don't think a fat penguin really embodies the grace of Linux, which just tells me they have never seen a angry penguin charging at them in excess of 100mph. They'd be a lot more careful about what they say if they had.
-- Linus Torvalds
[ Galahtech.com] | [ My Site] | [ Fishsponge] | [ UnixForum.co.uk]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|