|
-
Feb 15th, 2002, 10:40 AM
#1
Thread Starter
Frenzied Member
hyperlink
Does anyone have some code that i could use in one of my projects that when clicked will bring up a webpage in explorer/netscape or send an email in a program like outlook?
Thanks
Tom
-
Feb 15th, 2002, 10:54 AM
#2
Open A Web Page
VB Code:
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 Sub Command1_Click()
Dim OpenPage As Long
OpenPage = ShellExecute(Form1.hwnd, "Open", "http://www.vbexplorer.com",
0&, 0&, 0&)
End Sub
-
Feb 15th, 2002, 10:55 AM
#3
Send An EMail
VB Code:
Private Sub SendMailMessage(DisplayMsg As Boolean, Receiver As String, Optional
AttachmentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim CallDescription As String
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(Receiver)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add("an other person")
objOutlookRecip.Type = olCC
' Set the Subject, Body, and Importance of the message.
.Subject = "Replace this String With your subject Or variabele"
.Body = "replace this String With your subject Or variabele"
.Body = .Body & vbCrLf & "In this manner you can create a body larger than 256 characters"
' Add attachments to the message.
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Send
End If
End With
Set objOutlook = Nothing
End Sub
-
Feb 15th, 2002, 10:55 AM
#4
Thread Starter
Frenzied Member
cheers Hack
Last edited by TomGibbons; Sep 22nd, 2003 at 11:16 AM.
-
Feb 15th, 2002, 12:52 PM
#5
Frenzied Member
If you don't need to actually send the email from your app, and since not everyone has Outlook installed (I mean configured)
Than you propably just want to open the default email program, with a specified emailadress, than use this code:
VB Code:
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 Sub Command1_Click()
Dim OpenPage As Long
0&, 0&, 0&)
End Sub
And in VB.NET this would be:
Good Luck!
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Feb 15th, 2002, 02:25 PM
#6
Hey Jop: Using just the "Open", can you specifiy the text that goes into the body of a message, and attach attachments?
-
Feb 15th, 2002, 02:30 PM
#7
Frenzied Member
No, but did I say it could?
I'm not saying your code is bad or anything, just providing an alternative... the code I posted was just as an example to show the possibilities.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Feb 15th, 2002, 02:45 PM
#8
No, no, no Jop - you misunderstand. I'd like to know if you can do that because if you can, that would be a very cool alternative for folks that don't have Outlook. I don't know if you can. I was wondering if you knew.
-
Feb 15th, 2002, 03:30 PM
#9
-
Feb 15th, 2002, 04:13 PM
#10
Junior Member
Try this:
Code:
mailto:[email protected]?subject=My Subject&body=My Body Text&attach="C:\mydir\myfile.ext"
I know this works with Outlook, not sure about other e-mail clients though.
-
Feb 15th, 2002, 07:19 PM
#11
I would very much like to have someone NOT using Outlook to test Tom_H's code and let us know if it works.
-
Mar 10th, 2002, 11:26 AM
#12
Thread Starter
Frenzied Member
i think without outlook, it just popsup loads of internet explorer windows, does anyone eles get this?
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
|