Hi folks I'm new to the forms and have been reading a lot of posts about some issues which proved to be helpful, however I'm at an impasse with my limited knowledge of vba. Its totally possible I'm going about this the wrong way too, any suggestions or help in the right direction would be appreciated!
I have a macro which merely selects the link via offsetting the cell, then it opens the file via hyperlink (in this case) exportKR2CSV.html Once that is done it strips the information it needs closes the file exportKR2CSV.html ( all subsequent links have the same name regardless of the url/link)
It runs fine until we reach the 3rd link (in orange), which ultimately equals a either a dead or non-responsive link. This causes the macro to stop dead in its tracks. I’m not sure if it’s because when the dead or non-responsive URL is accessed it opens internet explorer and it takes the focus off Excel. I really have no idea why the macro stops once internet explorer opens. I tried a few if conditions all which seem to yield the same result.
[TABLE="width: 835"]
<tbody>[TR]
[TD]ABM[/TD]
[TD="colspan: 9"]http://financials.morningstar.com/a...M&culture=en-CA®ion=usa&order=asc&r=293323[/TD]
[/TR]
[TR]
[TD]ABR[/TD]
[TD="colspan: 9"]http://financials.morningstar.com/a...R&culture=en-CA®ion=usa&order=asc&r=293324[/TD]
[/TR]
[TR]
[TD]ABRN[/TD]
[TD]http://financials.morningstar.com/ajax/exportKR2CSV.html?t=ABRN&culture=en-CA®ion=usa&order=asc&r=293328[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]ABT[/TD]
[TD="colspan: 9"]http://financials.morningstar.com/a...T&culture=en-CA®ion=usa&order=asc&r=293329[/TD]
[/TR]
</tbody>[/TABLE]
Here is the excel file with the macro included :
http://xvertex.com/XLST/Links10.xlsm
Ideally what Id like it to do is to:
STEPS:
1- Select the cell required to open the link/excel file
2- Validate if the link is good or not. Then allow it to time out after 15 seconds and highlight it and move to step 5.
3- If it’s not good it should highlight it move down to the next row to select the next link/excel file
4- If its good it will strip the data it needs
5- And move on to the next cell and start back at the first step
I have a macro which merely selects the link via offsetting the cell, then it opens the file via hyperlink (in this case) exportKR2CSV.html Once that is done it strips the information it needs closes the file exportKR2CSV.html ( all subsequent links have the same name regardless of the url/link)
It runs fine until we reach the 3rd link (in orange), which ultimately equals a either a dead or non-responsive link. This causes the macro to stop dead in its tracks. I’m not sure if it’s because when the dead or non-responsive URL is accessed it opens internet explorer and it takes the focus off Excel. I really have no idea why the macro stops once internet explorer opens. I tried a few if conditions all which seem to yield the same result.
[TABLE="width: 835"]
<tbody>[TR]
[TD]ABM[/TD]
[TD="colspan: 9"]http://financials.morningstar.com/a...M&culture=en-CA®ion=usa&order=asc&r=293323[/TD]
[/TR]
[TR]
[TD]ABR[/TD]
[TD="colspan: 9"]http://financials.morningstar.com/a...R&culture=en-CA®ion=usa&order=asc&r=293324[/TD]
[/TR]
[TR]
[TD]ABRN[/TD]
[TD]http://financials.morningstar.com/ajax/exportKR2CSV.html?t=ABRN&culture=en-CA®ion=usa&order=asc&r=293328[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[TD]
[/TD]
[/TR]
[TR]
[TD]ABT[/TD]
[TD="colspan: 9"]http://financials.morningstar.com/a...T&culture=en-CA®ion=usa&order=asc&r=293329[/TD]
[/TR]
</tbody>[/TABLE]
Here is the excel file with the macro included :
http://xvertex.com/XLST/Links10.xlsm
Ideally what Id like it to do is to:
STEPS:
1- Select the cell required to open the link/excel file
2- Validate if the link is good or not. Then allow it to time out after 15 seconds and highlight it and move to step 5.
3- If it’s not good it should highlight it move down to the next row to select the next link/excel file
4- If its good it will strip the data it needs
5- And move on to the next cell and start back at the first step
Code:
[COLOR=#444444][FONT=Times New Roman]Sub Macro1()
'
' Macro1 Macro
'[/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman]Range("B1").Select
RunMacro:
Worksheets("Sheet1").Activate
ActiveCell.Offset(1, 0).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Visible = False
[COLOR=#00B050] 'Worksheets("Sheet1").Activate
'Application.ScreenUpdating = True
'Sheets("Sheet1").Select[/COLOR][/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman] ifOpen = Windows("exportKR2CSV.html").Visible = True
Application.ScreenUpdating = True[/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman] If ifOpen = "True" Then[/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman] GoTo Keepgoing
Else
GoTo RunMacro
End If[/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman] Keepgoing:
ActiveWindow.Visible = False
Windows("exportKR2CSV.html").Visible = True
Selection.Copy
ActiveWorkbook.Close False
Sheets("Sheet1").Select
Range("A17").Select[/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman][COLOR=#00B050]'ending:[/COLOR][/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman]End Sub[/FONT][/COLOR]
[COLOR=#444444][FONT=Times New Roman][B][I][B][I][FONT=Calibri]
[/FONT][/I][/B][/I][/B][/FONT][/COLOR]