Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

100 pts for urgent question 2

Posted on 2002-03-05
6
Medium Priority
?
144 Views
Last Modified: 2010-05-02
how to open a website/URL from VB?
0
Comment
Question by:wuyinzhi
6 Comments
 
LVL 54

Accepted Solution

by:
Ryan Chong earned 320 total points
ID: 6841175
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOW = 5

ShellExecute Me.hwnd, "open", Trim$(txtWebsite.Text), vbNullString, vbNullString, SW_SHOW
0
 
LVL 28

Expert Comment

by:Ark
ID: 6841178
Hi
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Public Sub NavigateTo(sUrl As String)
   Call ShellExecute(0&, vbNullString, sUrl, vbNullString, vbNullString, vbNormalFocus)
End Sub

Cheers
0
 

Expert Comment

by:aseem_dayal
ID: 6841359
Hi,

See if this helps :

1. Go to your project refferences and select "Microsoft    
   Internet Controls", which is a refference to shdocvw.dll

2. Add the following code for a command button click :

Dim ws As SHDocVw.InternetExplorer

Private Sub Command1_Click()

Set ws = New InternetExplorer

ws.Visible = True
ws.Navigate ("www.google.com")

End Sub

To use alternative browsers use the WebBrowser class included in this library.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 8

Expert Comment

by:vettranger
ID: 6841873
Or, if you need to see the web page code from inside your VB program :

url$ = "http://www.something.com"
q$ = Inet1.OpenURL(url$)

q$ now has the code from the web page to parse as you'd like.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6842066
:))
0
 
LVL 3

Author Comment

by:wuyinzhi
ID: 6843508
thanks all, especially to ryancys who gave me the solution first. Anyway just curious, is it possible to access an asp page without open the browser?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question