Hi,
I am using DTS to read data from Excel file. It can easily read data if the file is one the same server but for other server under the same domain it can gurantee that file exists after that it said file did not found.
Here is the script
filename = rs.fields("folder"
.value + filename
Set objFSO = CreateObject("Scripting.FileSystemObject"
if objFSO.FileExists(filename) Then
msgbox "File Exist"
else
msgbox "File Not Exist"
end if
Dim myXL
Dim myXLWorkSheet
'/// intializes the object variable
Set myXL = CreateObject("Excel.Application"
'/// opens the workbook
msgbox filename
myXL.Workbooks.Open filename ---Error
'/// intializes the activeworksheet variable
Set myXLWorkSheet = myXL.ActiveSheet
MsgBox myXLWorkSheet.Cells(2, 1).Value
myXL.ActiveWorkbook.Close "No", filename
'/// destroys the variables
Set myXLWorkSheet = Nothing
Set myXL = Nothing
I am authorized on this file & It displays that the file exists but when it try to open it said file not found.
Thanks
I am using DTS to read data from Excel file. It can easily read data if the file is one the same server but for other server under the same domain it can gurantee that file exists after that it said file did not found.
Here is the script
filename = rs.fields("folder"
Set objFSO = CreateObject("Scripting.FileSystemObject"
if objFSO.FileExists(filename) Then
msgbox "File Exist"
else
msgbox "File Not Exist"
end if
Dim myXL
Dim myXLWorkSheet
'/// intializes the object variable
Set myXL = CreateObject("Excel.Application"
'/// opens the workbook
msgbox filename
myXL.Workbooks.Open filename ---Error
'/// intializes the activeworksheet variable
Set myXLWorkSheet = myXL.ActiveSheet
MsgBox myXLWorkSheet.Cells(2, 1).Value
myXL.ActiveWorkbook.Close "No", filename
'/// destroys the variables
Set myXLWorkSheet = Nothing
Set myXL = Nothing
I am authorized on this file & It displays that the file exists but when it try to open it said file not found.
Thanks