Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error "Object Required"

Status
Not open for further replies.

BubbaJean

IS-IT--Management
Jun 5, 2002
111
0
0
US
Hmmmmmmmmmmmmm, I place in the your code and ran it now I get the following error message
"Error#:424 Object Required, Copy Failed"
below is the revised code

Private Sub cmdMoveFiles_Click()
On Error GoTo ErrorX
Dim x As SHFILEOPSTRUCT
Dim StrFile As String
StrFile = Me.DS_X1.Value
'Copies the file in textbox DS_X1
'String function to get rid of the "#" from the hyperlink.
x.pFrom = Mid(StrFile, 2, Len(StrFile) - 2)
'Pastes the file to stated location.
x.pTo = "K:\"
x.fFlags = FOF_NOCONFIRMATION
x.wFunc = FO_COPY
SHFileOperation x
fs.CopyFile strSourcePath, strDestinationPath
strSourcePath = "C:\" & Me.DS_X1.Value
strDestinationPath = "K:\" & Me.DS_X1.Value
Set fs = CreateObject("scripting.FileSystemObject", True)

MsgBox "Copy Complete.", vbOKOnly
Exit Sub
ErrorX:
MsgBox "Error #:" & Err.Number & " " & Err.Description & vbCrLf _
& "Copy Failed."
End Sub
 
Obviously the code can not find the file to copy or the drive to copy this file to.

Check the strSourcePath and strDestinationPath and see if they are getting any information i.e.
debug.print strSourcePath
debug.print strDestinationPath

Herman

They say that crime doesn't pay... does that mean my job is a crime?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top