Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > Open a website using VBA/Excel


Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2004, 04:29 PM
Celletje1974 Celletje1974 is offline
Newcomer
 
Join Date: Jan 2004
Posts: 3
Default Open a website using VBA/Excel


Guys (Girls?),

I have found some code on this forum that works great to open a website from VBA, but since it does refer to Internet Explorer, I suppose it will not work if the user of my spreadsheet does have a different webbrowser on his/her computer than IE. Is there a universal way to open a website from within VBA with "the standard program associated with the .html file extention" or something?

The code I am referring to is:

Sub VisitWebsite()

Dim ie As Object
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
ie.NAVIGATE "http://websiteaddress"
ie.Visible = True

While ie.busy
DoEvents
Wend

End Sub
Reply With Quote
  #2  
Old 01-13-2004, 05:09 PM
hulett819's Avatar
hulett819 hulett819 is offline
Centurion
 
Join Date: Jan 2004
Location: Raleigh, NC, USA
Posts: 120
Default

You can use the ShellExecute API command.

http://www.xtremevbtalk.com/show...t=shellexecute shows how it was done with a PDF document.

The actual specs of the API can be found http://www.mentalis.org/apilist/ShellExecute.shtml as well as example programs in VB that are easy to implement.

--hulett
Reply With Quote
  #3  
Old 01-13-2004, 05:34 PM
Celletje1974 Celletje1974 is offline
Newcomer
 
Join Date: Jan 2004
Posts: 3
Default

Hulett, thanks! The combination of both links made it clear to me.

Thanks,

Marcel
Reply With Quote
  #4  
Old 01-13-2004, 05:54 PM
herilane's Avatar
herilane herilane is offline
Unashamed geek

Retired Moderator
* Expert *
 
Join Date: Jul 2003
Location: London, England
Posts: 8,988
Default

One could of course just take the easy road and just use Excel's built-in capabilities - see Insomniac's post in this thread
Code:
Const Hyper As String = "http://www.xtremevbtalk.com" ThisWorkbook.FollowHyperlink Address:=Hyper ', NewWindow:=True

Last edited by herilane; 01-13-2004 at 06:57 PM.
Reply With Quote
  #5  
Old 01-13-2004, 06:25 PM
Celletje1974 Celletje1974 is offline
Newcomer
 
Join Date: Jan 2004
Posts: 3
Default

That's a beauty That must be the thing I've been looking for, but could not find... This has become the one-line-solution:

ThisWorkbook.FollowHyperlink Address:="http://www.mysite.nl", NewWindow:=True

Thanks!

Marcel
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to open a website with a commandbutton? Speedy Word, PowerPoint, Outlook, and Other Office Products 3 12-24-2003 08:29 PM
Beginner help with timers. School program... KreeZiE General 18 04-24-2003 05:45 PM
Makin a nice little program! Decontain Communications 3 04-11-2003 03:54 AM
Open a website in a specific size blossom General 1 01-29-2003 04:00 AM
how can i open a port and leave open rudy Communications 1 12-11-2000 09:26 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->