Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 26th, 2004, 11:09 AM
Authorized User
 
Join Date: Jul 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help starting Outlook w/ VBA

Beginner here....

I have an Excel spreadsheet at work the opens every morning when I turn on the PC. The "spreadsheet" is nothing other than a VBA module that opens a number of programs on my PC. I am having a bear of a time getting it to open Outlook, though.

Several versions of code I have tried are:

Dim myOlApp as New Outlook.Application
Set myspace = myOlApp.GetNameSpace("MAPI")

or

Dim myOlApp as Outlook.Application
Set myOlApp as New Outlook.Application
Set myspace = myOlApp.GetNameSpace("MAPI")

or

Dim myOlApp
Set myOlApp = CreateObject("Outlook.Application")
Set myspace = myOlApp.GetNameSpace("MAPI")

Every time I try to run my code I get a Visual Basic pop-up which says:

    Run-time error [long # follows]

    Automation error
    The specified module could not be found

The highlighted line of code is always the first one AFTER my Dim statement which employs "myOlApp".

Now, I HAVE CHECKED OFF the Tools/Reference boxes for MSFT Outlook 11.0 object library and have moved it to the the 3rd position in terms of priority among my Reference libraries. Further, if I go into Object Browser all of the objects, procedures, etc. for Outlook are there.

I have tried numerous permutations of the code above - all of which abort with the same "module not found" VB pop-up message.

Help!



ArtDecade
__________________
ArtDecade





Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to Outlook problem d12774 Access VBA 0 June 12th, 2007 03:04 PM
VBA in excel and outlook dlindamood2000 Excel VBA 19 December 7th, 2006 10:16 AM
E-mail using VBA and Outlook cc16 Access VBA 6 December 4th, 2006 11:07 AM
VBA Excel, outlook createobject Willie Johnson Jr Excel VBA 0 March 10th, 2006 05:11 AM
Receiving mail with Outlook 2000 VBA spotts-71 Pro VB 6 7 July 17th, 2003 03:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.