A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Creating a new Macro in Outlook



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 26th 06, 06:17 PM posted to microsoft.public.outlook.program_vba
jpotucek
external usenet poster
 
Posts: 7
Default Creating a new Macro in Outlook


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
Ads
  #2  
Old April 26th 06, 09:33 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Creating a new Macro in Outlook

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.

--
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


"jpotucek" wrote in message
...

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


  #3  
Old April 27th 06, 10:17 AM posted to microsoft.public.outlook.program_vba
jpotucek
external usenet poster
 
Posts: 7
Default Creating a new Macro in Outlook

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??


"Ken Slovak - [MVP - Outlook]" wrote:

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.

--
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


"jpotucek" wrote in message
...

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



  #4  
Old April 27th 06, 02:30 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Creating a new Macro in Outlook

Insert, Module.

--
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


"jpotucek" wrote in message
...
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??


"Ken Slovak - [MVP - Outlook]" wrote:

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.

--
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


"jpotucek" wrote in message
...

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




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook macro language Rich M Outlook and VBA 2 February 16th 06 01:10 AM
outlook macro matt Outlook and VBA 1 January 30th 06 01:30 PM
put macro into MS Outlook 2000 David C Outlook and VBA 4 January 25th 06 05:00 PM
VB and outlook macro need help jbullington Outlook and VBA 1 January 10th 06 03:22 PM


All times are GMT +1. The time now is 02:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.