Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,287 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 971 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
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
+Quote Post


akhileshbc
RE: Sending Email Macros
6 Oct, 2008 - 11:35 PM
Post #2

D.I.C Head
Group Icon

Joined: 26 Sep, 2008
Posts: 177



Thanked: 6 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
+Quote Post

Camulus
RE: Sending Email Macros
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
+Quote Post

akhileshbc
RE: Sending Email Macros
7 Oct, 2008 - 01:19 AM
Post #4

D.I.C Head
Group Icon

Joined: 26 Sep, 2008
Posts: 177



Thanked: 6 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
+Quote Post

thava
RE: Sending Email Macros
7 Oct, 2008 - 03:57 AM
Post #5

D.I.C Addict
Group Icon

Joined: 17 Apr, 2007
Posts: 670



Thanked: 35 times
Dream Kudos: 75
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
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 03:19PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month