Outlook Macro to get Exchange Info from Mail

  • Thread starter Thread starter _M_a_t_t_
  • Start date Start date
Status
Not open for further replies.
Try setting a reference to CDO.DLL in the references for your VBA project.

"_M_a_t_t_" <Matt> wrote in message

news:7F8668BC-7890-4214-BA17-45B096F82CEC@microsoft.com...
> Hopfully this reply is posted. Tried several time, and for some reason its
> not posting.

> When I run the code you posted above I get:
> Compile error:

> Assignment to constant not permitted

> on this line:
> Set CdoSession = CreateObject("MAPI.Session")
 
Hi Ken,


> Try setting a reference to CDO.DLL in the references for your VBA project.


I have this already:

Microsoft CDO 1.21 Library

C:\Program Files\Common Files\System\MSMAPI\1033\CDO.DLL

I'm starting to think this isn't possible.......
 
Hi Ken,


> Try setting a reference to CDO.DLL in the references for your VBA project.


I have this already:

Microsoft CDO 1.21 Library

C:\Program Files\Common Files\System\MSMAPI\1033\CDO.DLL

I'm starting to think this isn't possible......
 
Hi Ken,


> Try setting a reference to CDO.DLL in the references for your VBA project.


I have this already:

Microsoft CDO 1.21 Library

C:\Program Files\Common Files\System\MSMAPI\1033\CDO.DLL

I'm starting to think this isn't possible......
 
Found the/a solution.

Adding Option Explicit to the head of the Module, and then Diming each

variable finally got results. Wish someone had mentioned this....

This now brings me to my next two questions:

1. How to go though each element and not cause an error message to be

displayed when nothing is there (for example if

CdoPR_BUSINESS_ADDRESS_POSTAL_CODE is empty, I get an error that allows me to

End or Debug. I'd like to skip this, and just leave it empty)?

2. How to desable to prompt from Outlook asking if I want to allow the macro

to access:

A program is trying to access e-mail addresses you have stored in Outlook.

Do you want to allow this?

I can only allow 1, 2, 5 & 10 Minutes. But not an always allow. I have

digitally signed the macros, and all work without prompting until CDO is

accessed, then the prompt appears.
 
For 1 you'd add an On Error Resume Next statement and check for IsEmpty() on

the property and check for an error. If you have either you can clear the

error and just move on.

For 2 that's the reason most of stopped using CDO many years ago, the

security. Client side CDO actually has tighter security than the Outlook

object model (server side CDO has none of the security but should not be

installed where Outlook is installed). There are hacks and kludges such as

ExpressClickYes, but I'd rather not use things like that. As a substitute

for CDO most of us have moved on to using Redemption.

"_M_a_t_t_" <Matt> wrote in message

news:4A495EFD-77D9-4343-8D4A-311CB0DF92C3@microsoft.com...
> Found the/a solution.

> Adding Option Explicit to the head of the Module, and then Diming each
> variable finally got results. Wish someone had mentioned this....

> This now brings me to my next two questions:
> 1. How to go though each element and not cause an error message to be
> displayed when nothing is there (for example if
> CdoPR_BUSINESS_ADDRESS_POSTAL_CODE is empty, I get an error that allows me
> to
> End or Debug. I'd like to skip this, and just leave it empty)?
> 2. How to desable to prompt from Outlook asking if I want to allow the
> macro
> to access:
> A program is trying to access e-mail addresses you have stored in Outlook.
> Do you want to allow this?

> I can only allow 1, 2, 5 & 10 Minutes. But not an always allow. I have
> digitally signed the macros, and all work without prompting until CDO is
> accessed, then the prompt appears.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
E What is the next workaround for macro in New Outlook 1.2025.1111.100 Outlook VBA and Custom Forms 3
E Need to digitally sign macro but VBA\Outlook crash Outlook VBA and Custom Forms 4
J Outlook macro to run before email is being send Outlook VBA and Custom Forms 3
H Macro to Delete Duplicate items in Outlook calendar where title is the same and date is the same Outlook VBA and Custom Forms 0
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
C Outlook - Macro to block senders domain - Macro Fix Outlook VBA and Custom Forms 1
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
D Outlook 2016 Creating an outlook Macro to select and approve Outlook VBA and Custom Forms 0
S Outlook Macro for [Date][Subject] Using Outlook 1
E Outlook - Macro - send list of Tasks which are not finished Outlook VBA and Custom Forms 3
S Macro for Loop through outlook unread emails Outlook VBA and Custom Forms 2
Witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 7
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
M Outlook macro to automate search and forward process Outlook VBA and Custom Forms 6
R Macro Schedule every day in Outlook Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
N How can I increase/faster outlook VBA Macro Speed ? Using Outlook 2
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
V Outlook Macro to show Flagged messages Outlook VBA and Custom Forms 2
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
S Macro using .SendUsingAccount only works the first time, after starting Outlook Outlook VBA and Custom Forms 4
M Slow VBA macro in Outlook Outlook VBA and Custom Forms 5
A Forward Outlook Email by Filtering using Macro Rule Outlook VBA and Custom Forms 44
Tanja Östrand Outlook 2016 - Create Macro button to add text in Subject Outlook VBA and Custom Forms 1
D Outlook macro with today's date in subject and paste clipboard in body Outlook VBA and Custom Forms 1
C Outlook Subject Line Macro Outlook VBA and Custom Forms 0
D Macro sending outlook template from Excel list Outlook VBA and Custom Forms 6
P Macro to attach a file in a shared Outlook draft folder Outlook VBA and Custom Forms 2
R Macro to check file name with outlook address book Outlook VBA and Custom Forms 0
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook Using Outlook 0
W macro to export outlook emails to excel Outlook VBA and Custom Forms 6
J Outlook Macro to Update Sharepoint Excel File Using Outlook 1
Patrick van Berkel Best way to share (and keep up-to-date) Macro's in Outlook 2010 Outlook VBA and Custom Forms 6
C Newbie needs help with Outlook Macro Outlook VBA and Custom Forms 3
L Outlook 2007 - Macro Re Search Using Outlook 16
L Outlook 2007 Macro to Contact From a Field Using Outlook 3
A newb outlook macro help Outlook VBA and Custom Forms 1
Diane Poremsky Macro to Bulk Import Contacts and vCards into Outlook Using Outlook 0
S Outlook 7 VBA macro for multiple filing Outlook VBA and Custom Forms 1
S Macro in an excel for outlook. Outlook VBA and Custom Forms 2
A Outlook Macro Causing Excel Error Outlook VBA and Custom Forms 0
Diane Poremsky Use a macro to copy data in Outlook email to Excel workbook Using Outlook 0
S Outlook Macro Reply to a message Outlook VBA and Custom Forms 1
Diane Poremsky Macro to Bulk Import vCards into Outlook Using Outlook 0
M Outlook VBA Macro that could retrieve/display the (From, Subject, Date Received) Outlook VBA and Custom Forms 2
Philip Rose Recreating a WORD Editing Macro to use in Outlook VBA Outlook VBA and Custom Forms 4

Similar threads

Back
Top