Problem automating outlook


J

John

Hi

I am using the following code to automate outlook from within MS Access;

Dim O As Object
O = CreateObject("Outlook.Application")

The problem is that I am getting the following error on the second line;

Automation error
The specified module can not be found

What is the problem and how can I fix it?

Thanks

Regards
 
Ad

Advertisements

M

Mark Dormer

Dim O As Object
Set O = CreateObject("Outlook.Application")


Regards
Mark Dormer
 
M

Mark Dormer

I wasn't getting an error using the
Set O = CreateObject("Outlook.Application")


Perhaps it is something else in your code?
If you want paste it all.


FWIW I use this method.
In the VB Editor goto Tools - References and Add Microsoft Outlook 11.0
Library

Sub test()
Set ol = New Outlook.Application
Set olns = ol.GetNamespace("MAPI")
Set objFolder = olns.GetDefaultFolder(olFolderContacts)
End Sub



Regards
Mark Dormer
 
S

Sue Mosher [MVP-Outlook]

If you get an error from a code statement like this:

Set ol = CreateObject("Outlook.Application")

the cause may be an anti-virus program on your computer that has a feature to block Outlook scripting. The solution is to turn off the script blocking feature.

If you're using Symantec Anti Virus, make a backup of the Windows registry, and then see if these changes solve the problem:

1. Go to the HKEY_CLASSES_ROOT\Outlook.Application\CLSID key and note the (Default) value. It will be a GUID, most likely {0006F03A-0000-0000-C000-000000000046}.

2. Now go to the key HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InprocServer32 key, using the value from Step 1 if it's different from that shown above.

3. For the (Default) for that key, you should see this value:

C:\Program Files\Common Files\Symantec Shared\Script Blocking\ScrBlock.dll

Delete that text, so that the key's (Default) value becomes (value not set)


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
J

John

Apparently using

Set objOutlook = CreateObject("Outlook.Application","localhost")

fixes the problem. Not sure why though.

Regards
 
J

John

Apparently using

Set objOutlook = CreateObject("Outlook.Application","localhost")

fixes the problem. Not sure why though.

Regards

If you get an error from a code statement like this:

Set ol = CreateObject("Outlook.Application")

the cause may be an anti-virus program on your computer that has a feature
to block Outlook scripting. The solution is to turn off the script blocking
feature.

If you're using Symantec Anti Virus, make a backup of the Windows registry,
and then see if these changes solve the problem:

1. Go to the HKEY_CLASSES_ROOT\Outlook.Application\CLSID key and note the
(Default) value. It will be a GUID, most likely
{0006F03A-0000-0000-C000-000000000046}.

2. Now go to the key
HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InprocServer32
key, using the value from Step 1 if it's different from that shown above.

3. For the (Default) for that key, you should see this value:

C:\Program Files\Common Files\Symantec Shared\Script
Blocking\ScrBlock.dll

Delete that text, so that the key's (Default) value becomes (value not set)


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Ad

Advertisements

Joined
Oct 31, 2007
Messages
1
Reaction score
0
Sue's solution worked fine for me.

Yesterday I removed Norton AV 2004 by eTrust Antivirus.
Since then, my C# program talking to Outlook reported
"specified module not found". It turned out that there was
a lingering Symantec entry in the registry, blocking
Outlook scripts. Thanks to Sue the problem is solved.

John's solution may actually have bypassed the InprocServer32
entry, using the argument "localhost", or else the cause was
still different.

Great suggestion! Thanks again.

Eric


John said:
Apparently using

Set objOutlook = CreateObject("Outlook.Application","localhost")

fixes the problem. Not sure why though.

Regards

"Sue Mosher [MVP-Outlook]" wrote in message
news:ujMU14ZUGHA.1636@TK2MSFTNGP10.phx.gbl...
If you get an error from a code statement like this:

Set ol = CreateObject("Outlook.Application")

the cause may be an anti-virus program on your computer that has a feature
to block Outlook scripting. The solution is to turn off the script blocking
feature.

If you're using Symantec Anti Virus, make a backup of the Windows registry,
and then see if these changes solve the problem:

1. Go to the HKEY_CLASSES_ROOT\Outlook.Application\CLSID key and note the
(Default) value. It will be a GUID, most likely
{0006F03A-0000-0000-C000-000000000046}.

2. Now go to the key
HKEY_CLASSES_ROOT\CLSID\{0006F03A-0000-0000-C000-000000000046}\InprocServer32
key, using the value from Step 1 if it's different from that shown above.

3. For the (Default) for that key, you should see this value:

C:\Program Files\Common Files\Symantec Shared\Script
Blocking\ScrBlock.dll

Delete that text, so that the key's (Default) value becomes (value not set)


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Mark Dormer" wrote in message
news:ezjjw9TUGHA.3192@TK2MSFTNGP09.phx.gbl...
>I wasn't getting an error using the
> Set O = CreateObject("Outlook.Application")
>
>
> Perhaps it is something else in your code?
> If you want paste it all.
>
>
> FWIW I use this method.
> In the VB Editor goto Tools - References and Add Microsoft Outlook 11.0
> Library
>
> Sub test()
> Set ol = New Outlook.Application
> Set olns = ol.GetNamespace("MAPI")
> Set objFolder = olns.GetDefaultFolder(olFolderContacts)
> End Sub
>
>
>
> Regards
> Mark Dormer
>
>
>
> "John" wrote in message
> news:eGSM5BOUGHA.4608@tk2msftngp13.phx.gbl...
>>I am now using;
>>
>> Set O = CreateObject("Outlook.Application")
>>
>> and I am getting the attached error. Outlook 2003 seems to be working
>> fine
>> otherwise. I have also done a detect and repair on it as well.
>>
>> Regards
>>
>>
>> "Mark Dormer" wrote in message
>> news:OQnGOiJUGHA.776@TK2MSFTNGP09.phx.gbl...
>>> Dim O As Object
>>> Set O = CreateObject("Outlook.Application")
>>>
>>>
>>> Regards
>>> Mark Dormer
>>>
>>>
>>>
>>>
>>>
>>> "John" wrote in message
>>> news:eFs9QqIUGHA.1236@TK2MSFTNGP11.phx.gbl...
>>>> Hi
>>>>
>>>> I am using the following code to automate outlook from within MS
>>>> Access;
>>>>
>>>> Dim O As Object
>>>> O = CreateObject("Outlook.Application")
>>>>
>>>> The problem is that I am getting the following error on the second
>>>> line;
>>>>
>>>> Automation error
>>>> The specified module can not be found
>>>>
>>>> What is the problem and how can I fix it?
>>>>
>>>> Thanks
>>>>
>>>> Regards
>>>>
>>>
>>>

>>
>>
>>

>
>
 

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

Top