Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / April 2006

Tip: Looking for answers? Try searching our database.

Creating a new Macro in Outlook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jpotucek - 26 Apr 2006 18:17 GMT

I have an existing Macro in Outlook that basically scans an entire Mailbox
for Messages within a given data Range, dumps the data (date, email address
and email message body) into an excel file and then converts the excel to
.htm and places the .htm file output on a Network drive.

I would like to create a second macro - utilizing part of the code from the
first macro to read all emails and put the email addresses ONLY into a excel
file.

My problem is, when I launch outlook and then go to TOOLS/MACRO - I see my
original Macro and when I Overtype the name and click CREATE to create a new
Macro, I get this error:   Compile error - User Type not defined - the code
from my original Macro is displayed in the Code window and this line is
highlighted:

Dim xlApp As Excel.Application

I guess what I don't understand is - How to I create a new Macro from
scratch ????

When I Typed in a new Macro name, I expected to see an empty code window.

DO I need to create a new module or a whole new project???    Any guidance
or help would be much appreciated.

signed,
a VBA Newbie
Ken Slovak - [MVP - Outlook] - 26 Apr 2006 21:33 GMT
Alt+F11 to open the Outlook VBA editor. Place your macro code in a code
module there with the declaration as Public Sub. Your Sub must take no
incoming arguments for it to be a macro.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> I have an existing Macro in Outlook that basically scans an entire Mailbox
> for Messages within a given data Range, dumps the data (date, email
[quoted text clipped - 28 lines]
> signed,
> a VBA Newbie
jpotucek - 27 Apr 2006 10:17 GMT
Thanks.   When I do alt/f11 to bring up VBE - the code window is displaying
code for an existing Macro.   on the left hand side, it shows
Project1(ProjectName)
 -Microsoft Outlook Objects
     This Outlook Session
 -Modules
      Module1

I don't want to edit this existing Module1 code..   I want to start fresh...
what am I missing here??    
 

> Alt+F11 to open the Outlook VBA editor. Place your macro code in a code
> module there with the declaration as Public Sub. Your Sub must take no
[quoted text clipped - 32 lines]
> > signed,
> > a VBA Newbie
Ken Slovak - [MVP - Outlook] - 27 Apr 2006 14:30 GMT
Insert, Module.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Thanks.   When I do alt/f11 to bring up VBE - the code window is
> displaying
[quoted text clipped - 51 lines]
>> > signed,
>> > a VBA Newbie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.