Solved

100 pts for urgent question 2

Posted on 2002-03-05
6
141 Views
Last Modified: 2010-05-02
how to open a website/URL from VB?
0
Comment
Question by:wuyinzhi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 80 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
passing parameter in sql procedure 9 70
clicking a shape in a frame array vb6 3 55
Publisher:   Unknown     VB.exe Application 1 31
2 Global Vars, 1 List Box 4 33
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 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