|
-
Aug 8th, 2000, 03:32 PM
#1
Thread Starter
Member
Please Help!
I am trying to launch Internet Explorer from my VB application. The web site is stored on the database (either Cust or Vend). The first time through it runs perfectly. Everytime after that it bombs om me. I tried using a switch and refreshing the form after it executes once, but that didn't work. Thank You. My code:
Option Explicit
Dim WithEvents ie As InternetExplorer
Private Sub Form_Load()
Set ie = New InternetExplorer
With ie
.AddressBar = True
.MenuBar = True
.StatusBar = True
.Height = 500
.Width = 700
.Left = 0
.Top = 0
End With
End Sub
Private Sub cmdWeb_Click()
ie.Navigate txtWeb.Text
ie.Visible = True
End Sub
-
Aug 8th, 2000, 03:46 PM
#2
Addicted Member
Don't know exactly what you are doing but perhaps this will
help:
Module Level Code:
Code:
Option Explicit
Public Const URL = "http://www.some webSite.com"
Public Const email = "[email protected]"
Public 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 Const SW_SHOWNORMAL = 1
Public Sub gotoweb()
Dim Success As Long
Success = ShellExecute(0&, vbNullString, URL, vbNullString, "C:\", SW_SHOWNORMAL)
End Sub
Public Sub sendemail()
Dim Success As Long
Success = ShellExecute(0&, vbNullString, "mailto:" & email, vbNullString, "C:\", SW_SHOWNORMAL)
End Sub
'Form Level Code
'The following code is for two labels, one to activate
IE Explorer and one to activate Outlook Express
Private Sub labelURL_Click()
gotoweb
End Sub
Private Sub labelEmail_Click()
sendemail
End Sub
-
Aug 9th, 2000, 10:16 AM
#3
Thread Starter
Member
Thanks for your help. That wasn't quite the direction that I was headed, but I figured it out. Here is my revised code:
Option Explicit
Dim WithEvents ie As InternetExplorer
Dim WebSW As Boolean
Private Sub Form_Load()
WebSW = False
Set ie = New InternetExplorer
End Sub
Private Sub cmdWeb_Click()
If txtWeb.Text = "" Then
MsgBox "No web site for that vendor. To Add a web site, hit update, type the web site into the database, and hit save", _
vbExclamation + vbOKOnly, "Web"
Exit Sub
End If
If WebSW = True Then
Set ie = Nothing
Set ie = New InternetExplorer
End If
ie.Navigate txtWeb.Text
ie.Visible = True
WebSW = True
End Sub
When the user clicks on the Web command button on the form, Internet Explorer will pop-up with that website.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|