joyful88
asked on
writing to floppy and CD-R drives
In my application, I have a backup menu item, where when user clicks Backup, the Save dialog box appears. Saving to the hard drive works fine, but when i save to the floppy and CD-R drive i get errors.
Floppy: Method 'CopyFile' of object 'IFileSystem3' failed
CD: Run-time erro: '71': Disk not ready
here is my code for the backup:
Private Sub mnuBackup_Click()
Dim fs As Object
Dim varFileName, fsFolder, fsPath, fsFileName As String
comDlgBackup.ShowSave
varFileName = comDlgBackup.FileName
Set fs = CreateObject("Scripting.Fi leSystemOb ject")
fsFolder = fs.getparentfoldername(var FileName)
fsFileName = fs.getfilename(varFileName )
If fsFolder = "a:\" Or fsFolder = "e:\" Then fsPath = fsFolder + fsFileName Else fsPath = fsFolder + "\" + fsFileName
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsPath
End Sub
i would just like them to do an ordinary save. For the CD-R drive, i'd like the file to be copied over and Windows will alert me that there are files to be written unto disk (just like what XP does when you copy/write to disk).
thanks in advance to anyone who can help!
Floppy: Method 'CopyFile' of object 'IFileSystem3' failed
CD: Run-time erro: '71': Disk not ready
here is my code for the backup:
Private Sub mnuBackup_Click()
Dim fs As Object
Dim varFileName, fsFolder, fsPath, fsFileName As String
comDlgBackup.ShowSave
varFileName = comDlgBackup.FileName
Set fs = CreateObject("Scripting.Fi
fsFolder = fs.getparentfoldername(var
fsFileName = fs.getfilename(varFileName
If fsFolder = "a:\" Or fsFolder = "e:\" Then fsPath = fsFolder + fsFileName Else fsPath = fsFolder + "\" + fsFileName
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsPath
End Sub
i would just like them to do an ordinary save. For the CD-R drive, i'd like the file to be copied over and Windows will alert me that there are files to be written unto disk (just like what XP does when you copy/write to disk).
thanks in advance to anyone who can help!
Private Sub mnuBackup_Click()
Dim fs As Object
Dim varFileName, fsFolder, fsPath, fsFileName As String
comDlgBackup.ShowSave
varFileName = comDlgBackup.FileName
Set fs = CreateObject("Scripting.Fi leSystemOb ject")
NoDisk:
if err.number<>0 then
err.clear
Msgbox "Insert Disk in medium"
end if
fsFolder = fs.getparentfoldername(var FileName)
fsFileName = fs.getfilename(varFileName )
on error goto NoDisk
If fsFolder = "a:\" Or fsFolder = "e:\" Then fsPath = fsFolder + fsFileName Else fsPath = fsFolder + "\" + fsFileName
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsPath
End Sub
Dim fs As Object
Dim varFileName, fsFolder, fsPath, fsFileName As String
comDlgBackup.ShowSave
varFileName = comDlgBackup.FileName
Set fs = CreateObject("Scripting.Fi
NoDisk:
if err.number<>0 then
err.clear
Msgbox "Insert Disk in medium"
end if
fsFolder = fs.getparentfoldername(var
fsFileName = fs.getfilename(varFileName
on error goto NoDisk
If fsFolder = "a:\" Or fsFolder = "e:\" Then fsPath = fsFolder + fsFileName Else fsPath = fsFolder + "\" + fsFileName
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsPath
End Sub
ASKER
It seems to crash on the fs.copyfile method. The paths and file names work fine. Even when i go:
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsFileName
I still get the same error for the Floppy, but with the cd-r drive it doesn't save.
is there another way of copying a file without using copyfile method for floppies and cds?
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsFileName
I still get the same error for the Floppy, but with the cd-r drive it doesn't save.
is there another way of copying a file without using copyfile method for floppies and cds?
ASKER
It seems to crash on the fs.copyfile method. The paths and file names work fine. Even when i go:
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsFileName
I still get the same error for the Floppy, but with the cd-r drive it doesn't save.
is there another way of copying a file without using copyfile method for floppies and cds?
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsFileName
I still get the same error for the Floppy, but with the cd-r drive it doesn't save.
is there another way of copying a file without using copyfile method for floppies and cds?
oops sorry I forgot on
error resume next
statement
Private Sub mnuBackup_Click()
error resume next
Dim fs As Object
Dim varFileName, fsFolder, fsPath, fsFileName As String
comDlgBackup.ShowSave
varFileName = comDlgBackup.FileName
Set fs = CreateObject("Scripting.Fi leSystemOb ject")
NoDisk:
if err.number<>0 then
err.clear
Msgbox "Insert Disk in medium"
end if
fsFolder = fs.getparentfoldername(var FileName)
fsFileName = fs.getfilename(varFileName )
on error goto NoDisk
If fsFolder = "a:\" Or fsFolder = "e:\" Then fsPath = fsFolder + fsFileName Else fsPath = fsFolder + "\" + fsFileName
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsPath
on error goto 0
End Sub
error resume next
statement
Private Sub mnuBackup_Click()
error resume next
Dim fs As Object
Dim varFileName, fsFolder, fsPath, fsFileName As String
comDlgBackup.ShowSave
varFileName = comDlgBackup.FileName
Set fs = CreateObject("Scripting.Fi
NoDisk:
if err.number<>0 then
err.clear
Msgbox "Insert Disk in medium"
end if
fsFolder = fs.getparentfoldername(var
fsFileName = fs.getfilename(varFileName
on error goto NoDisk
If fsFolder = "a:\" Or fsFolder = "e:\" Then fsPath = fsFolder + fsFileName Else fsPath = fsFolder + "\" + fsFileName
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsPath
on error goto 0
End Sub
Are you running something like DirectCD which allows you to treat the CD as if it were a floppy? Generally you cannot copy files to a CD without using the CD writer software.
Perhaps you could copy the files to your hard drive then offline copy them to a removeable media.
mlmcc
Perhaps you could copy the files to your hard drive then offline copy them to a removeable media.
mlmcc
yes mlmcc is right, You need the direct cd to be active. and the Direct cd should have made the cd medium as ready. if an error occurs ask the user to make sure that the CD is writable
ASKER
No, i am not running a directCD, i just want the files to copy over onto the Save/CD drive window, then do the writting later on outside of the program.
i think i know why my floppy doesn't work ... my previous codes worked just fine, the file i was copying to the floppy was too big to fit! so that's one problem solved ... now how can i make saving to the CD work? any suggestions welcome!
i think i know why my floppy doesn't work ... my previous codes worked just fine, the file i was copying to the floppy was too big to fit! so that's one problem solved ... now how can i make saving to the CD work? any suggestions welcome!
Not sure I understand the Save/CD drive window.
Without using something like Direct CD you must use a program like Easy CD Creator. A CD is not directly addressable like a floppy.
mlmcc
Without using something like Direct CD you must use a program like Easy CD Creator. A CD is not directly addressable like a floppy.
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
where can i get directCD?
DirectCD came with my CD-RW as part of the software supplied.
It is part of EasyCreator CD by Roxio
www.roxio.com
mlmcc
It is part of EasyCreator CD by Roxio
www.roxio.com
mlmcc
I had got it with adaptec software which came with my cd writer
ASKER
so how can i incorporate this with my application? do i call somehow call it up? does Visual Basic 6 support it?
It runs on its own in the background. You can load it when you boot the system or you can start it from the start menu. Once it is running the CD can be treated like a floppy by any program.
mlmcc
mlmcc
its a driver the CD drive will be treated as a floppy drive for the OS so definately for VB too (as long as there is a valid CD in the drive.) just use it.
If fsFolder = "a:\" Then
fsPath = fsFolder + fsFileName
Else if fsFolder = "e:\" then
msgbox "There are files to copy to a CD. Please insert the disk"
fsPath = fsFolder + fsFileName
else
fsPath = fsFolder + "\" + fsFileName
end if
fs.copyfile "C:\Cutbank - VB6\data.mdb", fsPath
mlmcc