N
Neil Law
I'm trying to write VBA code that will invoke a URL to load a page and then
run another that causes the page to download an excel file.
I've gotten things to work but the file never seems to finish loading into
excel.
What I do is the following
1) do a Navigate2 for the page invocation url - works
2) on download complete I do a navigate2 for the second url
3) Get a prompt from excel - do you want to save or open - I select open
4) Progress dialog comes up and shows load is 100% complete but never
finishes.
Here's a code snippet if that helps:
Private Sub UserForm_Activate()
If Not userQueryRun Then
userQueryRun = True
webBrowser.Navigate2 queryToRun, 4
End If
End Sub
Private Sub webBrowser_DocumentComplete(ByVal pDisp As Object, URL As Variant)
frmJIRAWebView.LastQueryComplete
End Sub
Private Sub webBrowser_DownloadComplete()
frmJIRAWebView.LastQueryComplete
End Sub
Public Sub SetQuery(query As String)
queryToRun = query
userQueryRun = False
excelQueryRun = False
End Sub
Public Sub LastQueryComplete()
If excelQueryRun Then
querySuccessful = True
Hide
ElseIf userQueryRun And webBrowser.Busy = False Then
If Not excelQueryRun Then
webBrowser.Navigate2 EXCEL_QUERY, 4 ' no read from cache
excelQueryRun = True
End If
End If
End Sub
run another that causes the page to download an excel file.
I've gotten things to work but the file never seems to finish loading into
excel.
What I do is the following
1) do a Navigate2 for the page invocation url - works
2) on download complete I do a navigate2 for the second url
3) Get a prompt from excel - do you want to save or open - I select open
4) Progress dialog comes up and shows load is 100% complete but never
finishes.
Here's a code snippet if that helps:
Private Sub UserForm_Activate()
If Not userQueryRun Then
userQueryRun = True
webBrowser.Navigate2 queryToRun, 4
End If
End Sub
Private Sub webBrowser_DocumentComplete(ByVal pDisp As Object, URL As Variant)
frmJIRAWebView.LastQueryComplete
End Sub
Private Sub webBrowser_DownloadComplete()
frmJIRAWebView.LastQueryComplete
End Sub
Public Sub SetQuery(query As String)
queryToRun = query
userQueryRun = False
excelQueryRun = False
End Sub
Public Sub LastQueryComplete()
If excelQueryRun Then
querySuccessful = True
Hide
ElseIf userQueryRun And webBrowser.Busy = False Then
If Not excelQueryRun Then
webBrowser.Navigate2 EXCEL_QUERY, 4 ' no read from cache
excelQueryRun = True
End If
End If
End Sub