RogerCooper
Registered User.
- Local time
- Yesterday, 23:00
- Joined
- Jul 30, 2014
- Messages
- 479
Everyday, I download a list of recently received orders from a website using a Selenium script. The site always downloads the file as "Export.xlsx ". If I try to link/download it directly, I receive the error, "The wizard is unable to access information in the file <filename>. Please check that the file exists and is in the correct format."
If I open the file manually and then do a SaveAs, the file becomes linkable. I would like to avoid doing that manual step.
I have tried using VBA code, but it fails half the time because the file is not showing as existing in the folder, even with a 10 second wait.
If I open the file manually and then do a SaveAs, the file becomes linkable. I would like to avoid doing that manual step.
I have tried using VBA code, but it fails half the time because the file is not showing as existing in the folder, even with a 10 second wait.
Code:
Call DeleteFile("g:\TC_Sent.xlsx")
bot.Wait 10000
If FileExists("g:\Export.xlsx") Then
Set WB = Workbooks.Open("g:\Export.xlsx")
WB.SaveAs FileName:="g:/TC_Sent.xlsx", FileFormat:=xlOpenXMLWorkbook
Workbooks.Close
Else
MsgBox "Open g:\Export.xlsx, save manually to g:\TC_Sent.xlsx and close"
Stop
End If
I tried turning off protection from downloaded files, but it did not help.
Any ideas as to how I can reliably automate this or avoid the error when linking/downloading.