Author |
Topic |
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 01 June 2005 : 08:00:59
|
I prefer to Insert a Module, into the Microsoft Outlook Object and paste the code into the module. The code is currently a function. You can change the function into a Sub and execute directly from the Macros window, or insert a new Sub to call the function.
P.S.: I usually don't do this from Outlook. I use the same code from Access, directly, so it may be possible to do it differently. |
Snitz 3.4 Readme | Like the support? Support Snitz too |
Edited by - ruirib on 01 June 2005 08:04:46 |
|
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 01 June 2005 : 08:06:24
|
Thanks, Rui, I'll let you know how I get on.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 01 June 2005 : 10:10:22
|
Stuck already! When I hit the play icon in the toolbar to run the script I get a prompt to enter a name for my script with the "Run" button grayed out but no matter what name I try to give it, I cannot use the "Run" button, the only button not grayed out is "Cancel".
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 01 June 2005 : 10:31:24
|
Ay, it's a sub.
edit: Wait, think I get you, now, hang on a tick ...
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 01 June 2005 10:32:33 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 01 June 2005 : 10:40:17
|
Now I see I can't run the sub from within the VB editor itself I have to go Macros under tools in Outlook.
OK, now I've firgured that out, I've hit an error on line 5: "User-defined type not defined" with the highlighted code being: cnn As ADODB.Connection.
Sub is here.
Oh, and while I'm at it, I don't see anywhere in the sub for me to assign my mail server and address to send from, does this mean I'll have to set up an address in Outlook?
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 01 June 2005 10:42:22 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
Posted - 01 June 2005 : 12:44:01
|
Shaggy,
In the Visual Basic window, select Tools->References and then add a reference to one of the Microsoft ActiveX Data Objects library. That will fix the error. The code will send the emails through your default Outlook account. I don't know how to change that, sorry. |
Snitz 3.4 Readme | Like the support? Support Snitz too |
|
|
seahorse
Senior Member
USA
1075 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 02 June 2005 : 05:37:31
|
Thanks, Ken, will add that to me list.
Finally got everything debugged but now Outlook is telling me:
"The macros in this project are disabled. Please refer to the online help or documentation of the host application to determine how to enable macros."
I don't have the Outlook's help files installed so can't look it up but I tried lowering the security level for Macros but it didn't help any.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
Edited by - Shaggy on 02 June 2005 05:38:15 |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
gelliott
Junior Member
USA
268 Posts |
Posted - 09 June 2005 : 12:30:20
|
ruirib,
Perhaps you can help me with a similar issue. I am trying to write some VB code in MS Access 2000 to send emails with attachments using the default email client (not outlook - my company uses Lotus Notes). I have written what I think is a fairly robust script for using the MAPI API (mapi32.dll) on a Win XP Pro machine, but it errors out and none of the google results on the error are much help. Can you or someone look at the file and see what's amiss?
The zipped db (about 300kb) is here.
The email functions are in a module in the back, and the form's code has the other stuff. Only minimal test data is loaded in the db. the form that opens at startup has a list of addresses to select from, then you hit the button to send the message. It does save a small text file on your HD in the root C folder (for passing the test attachment to the email client).
Any suggestions on making this work would be appreciated... |
* The optimist says the cup is half full. The pessimist says it's half empty. But the engineer knows the truth - the cup's design is incorrectly sized. |
|
|
ruirib
Snitz Forums Admin
Portugal
26364 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 10 June 2005 : 04:53:28
|
Got distracted by a mountain of work, Rui (this was just me planning a bit ahead). Have that page bookmarked so hopefully I'll be back to it some time next week.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
Topic |
|