Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 132,172 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,562 people online right now. Registration is fast and FREE... Join Now!




Sending Email macros

 
Reply to this topicStart new topic

Sending Email macros, I am trying to create a macro to send an email to a specifc mailbox

Camulus
post 6 Oct, 2008 - 11:12 PM
Post #1


New D.I.C Head

*
Joined: 6 Oct, 2008
Posts: 2

Please could some one advise.

I have the following code to try and send a page via email to one of my colleagues. It is a repetative task whick is why i have tried to assign the macro to a button in my spread sheet.

I keep getting syntax error everytime i try to execute the macro.


CODE

'Declarations
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
'code
ShellExecute hwnd, "open", "mailto:email address", vbNullString, vbNullString, SW_SHOW

Rgrds and thanks

Camulus

** Edit ** code.gif
User is offlineProfile CardPM

Go to the top of the page

akhileshbc
post 6 Oct, 2008 - 11:35 PM
Post #2


D.I.C Head

Group Icon
Joined: 26 Sep, 2008
Posts: 177



Thanked 3 times

Dream Kudos: 50
My Contributions


QUOTE
'Declarations
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
'code
ShellExecute hwnd, "open", "mailto:email address", vbNullString, vbNullString, SW_SHOW

Try this:
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 Const SW_SHOW = 5

'code
ShellExecute hwnd, "open", "mailto:email address", vbNullString, vbNullString, SW_SHOW


User is offlineProfile CardPM

Go to the top of the page

Camulus
post 7 Oct, 2008 - 12:57 AM
Post #3


New D.I.C Head

*
Joined: 6 Oct, 2008
Posts: 2

Thanks for your help but i'm not sure whether it is because i am a total beginner or because i have an old version of VB but i still keep getting error messages come up when i try to run the macro.

Rgrds

Camulus
User is offlineProfile CardPM

Go to the top of the page

akhileshbc
post 7 Oct, 2008 - 01:19 AM
Post #4


D.I.C Head

Group Icon
Joined: 26 Sep, 2008
Posts: 177



Thanked 3 times

Dream Kudos: 50
My Contributions


The above code works in vb6. But i dont know whether it will run in vbscript.
User is offlineProfile CardPM

Go to the top of the page

thava
post 7 Oct, 2008 - 03:57 AM
Post #5


D.I.C Regular

Group Icon
Joined: 17 Apr, 2007
Posts: 424



Thanked 17 times

Dream Kudos: 50
My Contributions


did you try the shell command
QUOTE
I keep getting syntax error everytime i try to execute the macro.


User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/21/08 03:14PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month