Asked by duncanb7
at 2024-04-04 10:49:39
Point:500 Replies:4 POST_ID:828462USER_ID:11059
Topic:
Visual Basic Programming;;Microsoft Excel Spreadsheet Software
Generally, I like write VBA code in Excel xls file and then save as html file
and broswer the htm file in IE.
Now I get one Excel file saved as htm format because I will read it in IE windows.
and in the file sheet, and I add hyperlink in the one cells by VBA like following
small code
ActiveSheet.Cells(1,1).Select
ActiveSheet.Cells(1,1) = "Chart"
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="http://www.chart.com"
When I open the htm file in IE 7, and click the link that will be opened in the same windows
as the htm file window, and I go to notepad/edit the html file and see what happen at <a href> tag and found this
html code in my htm file as
<td class=xl155><a href="http://www.chart.com"
target="_parent ">Chart</a></td>
How can I change it to taget="_blank" from "_parent" in VBA? actually I could do it by replace function in vba
to seach _parent text in htm file and replace with __blank but I would like or prefer to see there is VBA code for this first
Any suggestion ?
Try the following three code, but all is not what I want
1-ThisWorkbook.FollowHyperlink Address:="http://www.chart.com", NewWindow:=True
2-ActiveWorkbook.FollowHyperlink Address:=Selection, NewWindow:=True
'3-Selection.Hyperlinks(1).Follow NewWindow:=True
Please advise, it should a VBA solution for that, and I have viewed this http://www.w3schools.com/tags/att_a_target.asp
target="_blanK" is opening hyperlink in a new window
Duncan
and broswer the htm file in IE.
Now I get one Excel file saved as htm format because I will read it in IE windows.
and in the file sheet, and I add hyperlink in the one cells by VBA like following
small code
ActiveSheet.Cells(1,1).Select
ActiveSheet.Cells(1,1) = "Chart"
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="http://www.chart.com"
When I open the htm file in IE 7, and click the link that will be opened in the same windows
as the htm file window, and I go to notepad/edit the html file and see what happen at <a href> tag and found this
html code in my htm file as
<td class=xl155><a href="http://www.chart.com"
target="_parent ">Chart</a></td>
How can I change it to taget="_blank" from "_parent" in VBA? actually I could do it by replace function in vba
to seach _parent text in htm file and replace with __blank but I would like or prefer to see there is VBA code for this first
Any suggestion ?
Try the following three code, but all is not what I want
1-ThisWorkbook.FollowHyperlink Address:="http://www.chart.com", NewWindow:=True
2-ActiveWorkbook.FollowHyperlink Address:=Selection, NewWindow:=True
'3-Selection.Hyperlinks(1).Follow NewWindow:=True
Please advise, it should a VBA solution for that, and I have viewed this http://www.w3schools.com/tags/att_a_target.asp
target="_blanK" is opening hyperlink in a new window
Duncan