Peter Chan
asked on
Problem to copy file
Hi,
I get
due to this line
FileSystemObject.CopyFile Source, Dest
while Source is having value
\\hkgmoss\sites\a4\IT\Proj ects\Excel Tool\Budge tExcelTool \CHINA\Asi aPacific_B udget_HO_2 016-May.xl sm
Dest is
\\hkgmoss\sites\a4\IT\Proj ects\Excel Tool\Budge tExcelTool \CHINA\Asi aPacific_B udget_HO_C HINA_2016- Jun.xlsm
I get
due to this line
FileSystemObject.CopyFile Source, Dest
while Source is having value
\\hkgmoss\sites\a4\IT\Proj
Dest is
\\hkgmoss\sites\a4\IT\Proj
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I still get error due to these
Dim fso As New FileSystemObject
fso.CopyFile Source, Dest
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the error is
Compile error:
User-defined type not defined
then Ryan Chong's advice should work
Whenever you want to ask about an error, please tell us what the error message is.
Compile error:
User-defined type not defined
then Ryan Chong's advice should work
Whenever you want to ask about an error, please tell us what the error message is.
ASKER
I get
due to last line below
due to last line below
Source = Replace(Replace(Source, "\", "/"), "//", "http://"): Dest = Replace(Replace(Dest, "\", "/"), "//", "http://")
Dim fso As Object
'Set fso = VBA.CreateObject("Scripting.FileSystemObject")
Set fso = CreateObject("Scripting.FileSystemObject")
'Dim fso As New FileSystemObject
fso.CopyFile Source, Dest
and Source is having valuehttp://hkgmoss/sites/a4/IT/Projects/ExcelTool/BudgetExcelTool/CHINA/AsiaPacific_Budget_HO_2016-May.xlsm
while Dest ishttp://hkgmoss/sites/a4/IT/Projects/ExcelTool/BudgetExcelTool/CHINA/AsiaPacific_Budget_HO_CHINA_2016-Jun.xlsm
I still get the same problem even if I did not do replace on 1st line in above.
ASKER
Please leave my last reply in above
Open in new window