send e-mail from access (97)

  • Thread starter Thread starter Harry Betlem
  • Start date Start date
H

Harry Betlem

Hi there,
As I refer to, I am having a slight problem in sending an e-mail from Access 97,
with the use of Outlook 97.

Things do run as they should, if I stick to the "CurrentUser" in Outlook(97)
But...
I want the e-mails to be sent under the name of another user.
I made another profile, and now I want to check weather OL is running under the
CurrentUser Profile,
if so, change the profile to the other User, and send the mail.
Afterwards, set the user back to Current user.

I tried this... but I think it could be done better, quicker

Code snippet:

Set objOutlook = CreateObject("Outlook.Application")
Set nsOutlook = objOutlook.GetNamespace("MAPI")
If nsOutlook.CurrentUser = "Harry Betlem" Then
nsOutlook.Logoff '(This seemed Not enough)
nsOutlook.Application.Quit
Set nsOutlook = objOutlook.GetNamespace("MAPI")
nsOutlook.Logon "Shadow Record", "", False, True
Else
nsOutlook.Logon "Shadow Record", "", False, True
End If
End code snippet

Any help welcome

Harry Betlem
(e-mail address removed)
 
No need for reply.
Found a workaround.
Using API to set the 'name' of the e-mail accont just before running the send
mail.

in short:
Check if outlook is running
if so, close it ('remember it')
Change Registry (name of 'CurrentUser')
Re-open Outlook
Send e-mail
Close Outlook
Set CurrentUser back to original name
If outlook WAS open, re-open it with "Shell"
Ready!!

It took me some time to find the appropriate code.
available for those who are interested through e-mail


In Harry Betlem dropped the
following:
|| Hi there,
|| As I refer to, I am having a slight problem in sending an e-mail
|| from Access 97, with the use of Outlook 97.
||
|| Things do run as they should, if I stick to the "CurrentUser" in
|| Outlook(97) But...
|| I want the e-mails to be sent under the name of another user.
|| I made another profile, and now I want to check weather OL is
|| running under the CurrentUser Profile,
|| if so, change the profile to the other User, and send the mail.
|| Afterwards, set the user back to Current user.
||
|| I tried this... but I think it could be done better, quicker
||
|| Code snippet:
||
|| Set objOutlook = CreateObject("Outlook.Application")
|| Set nsOutlook = objOutlook.GetNamespace("MAPI")
|| If nsOutlook.CurrentUser = "Harry Betlem" Then
|| nsOutlook.Logoff '(This seemed Not enough)
|| nsOutlook.Application.Quit
|| Set nsOutlook = objOutlook.GetNamespace("MAPI")
|| nsOutlook.Logon "Shadow Record", "", False, True
|| Else
|| nsOutlook.Logon "Shadow Record", "", False, True
|| End If
|| End code snippet
||
|| Any help welcome
||
|| Harry Betlem
|| (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top