PDA

View Full Version : [SOLVED:] Outside of Excel ss



Tenspeed39355
02-15-2005, 03:43 PM
Can a macro be written to go outside the Excel ss to a web page. and once there go to another page within the site?
Max

johnske
02-15-2005, 10:20 PM
Hi tenspeed,

If you know the URL of the 2nd page, why not go directly there?



Option Explicit

Sub BeamMeUpScotty()
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
On Error Goto 1
With ie
.navigate "http://www.(put your addy here) (http://www.(put%20your%20addy%20here)/)"
.Visible = True
End With
Set ie = Nothing
Exit Sub
1: MsgBox Err.Description
ie.Quit
Set ie = Nothing
End Sub

Regards
John

CBrine
02-16-2005, 07:33 AM
You can also use the Microsoft Web Browser control, directly in your worksheet. It's an ActiveX control. Then use the

WebBrowser1.Navigate "www.vbaexpress.com (http://www.vbaexpress.com)"

and now you have a browser window in a form, on imbedded on your worksheet.

HTH
Cal

johnske
02-16-2005, 02:40 PM
Provided the web page is html - you can also open it as a workbook with this:


Sub OpenHTMLpage()
'set the URL you want below
Application.Workbooks.Open(http://www.geocities.com/johnske100/TheFINDfunction.html) (http://www.geocities.com/johnske100/TheFINDfunction.html)
Columns(1).ColumnWidth = 85
End Sub

(The column width has to be set large as the page is opened in column A). When you click any links shown on the spreadsheet-webpage, IE will then open.

If you want to download something from the webpage, you can use something like this:


Sub OpenHTMLpageDownload()
Application.Workbooks.Open ("http://www.geocities.com/johnske100/index.html")
Range("A40").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub

CBrine
02-16-2005, 02:51 PM
Johnske,
I didn't know you could do that. Pretty cool.

PS-Found a syntax error, should be "'s not )'s.




Sub OpenHTMLpage()
'set the URL you want below
Application.Workbooks.Open "http://www.geocities.com/johnske100/TheFINDfunction.html"
Columns(1).ColumnWidth = 85
End Sub

johnske
02-16-2005, 03:50 PM
Johnske,
I didn't know you could do that. Pretty cool.

PS-Found a syntax error, should be "'s not )'s.



Sub OpenHTMLpage()
'set the URL you want below
Application.Workbooks.Open "http://www.geocities.com/johnske100/TheFINDfunction.html"
Columns(1).ColumnWidth = 85
End Sub





Hi Cal,


?? It worked fine with the brackets on mine (Win98SE+Office2000) - and without them, but just for my reference, what are you using ??

Regards,
John

johnske
02-16-2005, 03:52 PM
OOPs, sorry, I see now - the quotation marks went MIA

CBrine
02-22-2005, 07:19 AM
Ah, Same thing happened to me, I just double quoted them, didn't even think the same thing would have to you. That explains it.

PS- Office 2003-Win 2000