Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a new Outlook Macro

Status
Not open for further replies.

jpotucek

Technical User
Jan 26, 2005
144
US

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
 
You have to reference the Microsoft Excel x.y Object Library:
when in VBE menu Tools -> References ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 

THank you!!! Adding the reference for excel x.y Object Library worked like a charm!!!!

I still can't figure out how to create a new Macro from scratch though.. When I Type in a new Macro name and click create, I expect to see an empty code window but it instead pulls in code from my original macro.. What am I doing wrong??????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top