Asked by duncanb7
at 2024-10-07 07:00:43
Point:250 Replies:7 POST_ID:828371USER_ID:11059
Topic:
Microsoft Excel Spreadsheet Software;;Visual Basic Programming
I am using VBA Excel setcursorpostion and mouse's leftdown to download a file called example.csv from one website and the file size is big, how can I know the file is saved or not ( download is finished or not) or (completed or not) by VBA ? Since I Need to open the example.csv file after download for other VBA
operation. Please see my main sub for detail and download sub in main sub is no any isue
THe problem is when the file example, example.csv is opened in Excel by VBA, the example.csv file is
just part of the file only since download time is really long like 10 seconds. I want
to know what is good VBA method to check the file is completed download before any file open ?
I try to use DIR( ) that is not okay because it just check the file name is existed or not.
ANd I also try to use .saved in VBA but that return Run-time error. Please help to
advise
Duncan
"Run-time Error "
if workbooks(wkdir).saved= true then
workbooks.open filename= wkdir ReadOnly:=True
Else
debug.print "Dowload not completed"
Endif
Sub mian ()
Dim wkdir as string
call download()
wkdir ="C:example.csv"
if Dir(wkdir) <> "" then
workbooks.open filename= wkdir ReadOnly:=True
Else
debug.print "Download not completed"
Endif
operation. Please see my main sub for detail and download sub in main sub is no any isue
THe problem is when the file example, example.csv is opened in Excel by VBA, the example.csv file is
just part of the file only since download time is really long like 10 seconds. I want
to know what is good VBA method to check the file is completed download before any file open ?
I try to use DIR( ) that is not okay because it just check the file name is existed or not.
ANd I also try to use .saved in VBA but that return Run-time error. Please help to
advise
Duncan
"Run-time Error "
if workbooks(wkdir).saved= true then
workbooks.open filename= wkdir ReadOnly:=True
Else
debug.print "Dowload not completed"
Endif
Sub mian ()
Dim wkdir as string
call download()
wkdir ="C:example.csv"
if Dir(wkdir) <> "" then
workbooks.open filename= wkdir ReadOnly:=True
Else
debug.print "Download not completed"
Endif