PC Review


Reply
Thread Tools Rate Thread

Create macro in Outlook 2007

 
 
=?Utf-8?B?S2V2aW5zbQ==?=
Guest
Posts: n/a
 
      10th Jul 2007
In Outlook 2003 I was able to use a macro I had created in Word to insert the
day, date, and time at the beginning of a new email. Outlook 2007 has no
"macro-record" function and my attempt to import a similar macro I created in
Word 2007 has failed ... when I run it, it results in an error message and I
have no clue how to debug. Any counsel?
 
Reply With Quote
 
 
 
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      10th Jul 2007


Outlook never had a macro recorder, probably you're talking about Word.
What's the code?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:

> In Outlook 2003 I was able to use a macro I had created in Word to insert

the
> day, date, and time at the beginning of a new email. Outlook 2007 has no
> "macro-record" function and my attempt to import a similar macro I created

in
> Word 2007 has failed ... when I run it, it results in an error message and

I
> have no clue how to debug. Any counsel?

 
Reply With Quote
 
=?Utf-8?B?S2V2aW5zbQ==?=
Guest
Posts: n/a
 
      11th Jul 2007
Right, thanks Michael, it was a macro created in Word and then able to be
used in Outlook 2003 since Word was the message editor ... evidently no
longer the case.

The code is:
Sub DT()
'
' DT Macro
'
'
Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
wdCalendarWestern, InsertAsFullWidth:=False
Selection.MoveLeft Unit:=wdCharacter, Count:=5
Selection.TypeBackspace
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" / "
Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:= _
False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
End Sub

Thanks for your help!

"Michael Bauer [MVP - Outlook]" wrote:

>
>
> Outlook never had a macro recorder, probably you're talking about Word.
> What's the code?
>
> --
> Viele Gruesse / Best regards
> Michael Bauer - MVP Outlook
> Organize eMails:
> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>
> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
>
> > In Outlook 2003 I was able to use a macro I had created in Word to insert

> the
> > day, date, and time at the beginning of a new email. Outlook 2007 has no
> > "macro-record" function and my attempt to import a similar macro I created

> in
> > Word 2007 has failed ... when I run it, it results in an error message and

> I
> > have no clue how to debug. Any counsel?

>

 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      11th Jul 2007


Not tested but this might work. Add a reference to Word's library
(Tools/References) and insert this at the beginning of your code:

Dim Document as Word.Document
Dim Selection as Word.Selection

Set Document=Application.ActiveInspector.WordEditor
Set Selection=Document.ActiveWindow.Selection

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Tue, 10 Jul 2007 18:44:01 -0700 schrieb Kevinsm:

> Right, thanks Michael, it was a macro created in Word and then able to be
> used in Outlook 2003 since Word was the message editor ... evidently no
> longer the case.
>
> The code is:
> Sub DT()
> '
> ' DT Macro
> '
> '
> Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
> wdCalendarWestern, InsertAsFullWidth:=False
> Selection.MoveLeft Unit:=wdCharacter, Count:=5
> Selection.TypeBackspace
> Selection.EndKey Unit:=wdLine
> Selection.TypeText Text:=" / "
> Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:=

_
> False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern,

_
> InsertAsFullWidth:=False
> End Sub
>
> Thanks for your help!
>
> "Michael Bauer [MVP - Outlook]" wrote:
>
>>
>>
>> Outlook never had a macro recorder, probably you're talking about Word.
>> What's the code?
>>
>> --
>> Viele Gruesse / Best regards
>> Michael Bauer - MVP Outlook
>> Organize eMails:
>>

<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>>
>> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
>>
>>> In Outlook 2003 I was able to use a macro I had created in Word to

insert
>> the
>>> day, date, and time at the beginning of a new email. Outlook 2007 has

no
>>> "macro-record" function and my attempt to import a similar macro I

created
>> in
>>> Word 2007 has failed ... when I run it, it results in an error message

and
>> I
>>> have no clue how to debug. Any counsel?

>>

 
Reply With Quote
 
=?Utf-8?B?S2V2aW5zbQ==?=
Guest
Posts: n/a
 
      11th Jul 2007
I made the change you suggested and I am now getting the following error
message:
[Microsoft Visual Basic]
Compile error:
User-defined type not defined

By the way following your suggestion, the code now is:
Sub DT()
'
' DT Macro
'
'
Dim Document As Word.Document
Dim Selection As Word.Selection

Set Document = Application.ActiveInspector.WordEditor
Set Selection = Document.ActiveWindow.Selection

Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
wdCalendarWestern, InsertAsFullWidth:=False
Selection.MoveLeft Unit:=wdCharacter, Count:=5
Selection.TypeBackspace
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" / "
Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:= _
False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern, _
InsertAsFullWidth:=False
End Sub


"Michael Bauer [MVP - Outlook]" wrote:

>
>
> Not tested but this might work. Add a reference to Word's library
> (Tools/References) and insert this at the beginning of your code:
>
> Dim Document as Word.Document
> Dim Selection as Word.Selection
>
> Set Document=Application.ActiveInspector.WordEditor
> Set Selection=Document.ActiveWindow.Selection
>
> --
> Viele Gruesse / Best regards
> Michael Bauer - MVP Outlook
> Organize eMails:
> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>
> Am Tue, 10 Jul 2007 18:44:01 -0700 schrieb Kevinsm:
>
> > Right, thanks Michael, it was a macro created in Word and then able to be
> > used in Outlook 2003 since Word was the message editor ... evidently no
> > longer the case.
> >
> > The code is:
> > Sub DT()
> > '
> > ' DT Macro
> > '
> > '
> > Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> > InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
> > wdCalendarWestern, InsertAsFullWidth:=False
> > Selection.MoveLeft Unit:=wdCharacter, Count:=5
> > Selection.TypeBackspace
> > Selection.EndKey Unit:=wdLine
> > Selection.TypeText Text:=" / "
> > Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:=

> _
> > False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern,

> _
> > InsertAsFullWidth:=False
> > End Sub
> >
> > Thanks for your help!
> >
> > "Michael Bauer [MVP - Outlook]" wrote:
> >
> >>
> >>
> >> Outlook never had a macro recorder, probably you're talking about Word.
> >> What's the code?
> >>
> >> --
> >> Viele Gruesse / Best regards
> >> Michael Bauer - MVP Outlook
> >> Organize eMails:
> >>

> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >>
> >> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
> >>
> >>> In Outlook 2003 I was able to use a macro I had created in Word to

> insert
> >> the
> >>> day, date, and time at the beginning of a new email. Outlook 2007 has

> no
> >>> "macro-record" function and my attempt to import a similar macro I

> created
> >> in
> >>> Word 2007 has failed ... when I run it, it results in an error message

> and
> >> I
> >>> have no clue how to debug. Any counsel?
> >>

>

 
Reply With Quote
 
Michael Bauer [MVP - Outlook]
Guest
Posts: n/a
 
      11th Jul 2007


Did you add a ref to 'Microsoft Word x Object Library'?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Organize eMails:
<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>

Am Tue, 10 Jul 2007 23:26:00 -0700 schrieb Kevinsm:

> I made the change you suggested and I am now getting the following error
> message:
> [Microsoft Visual Basic]
> Compile error:
> User-defined type not defined
>
> By the way following your suggestion, the code now is:
> Sub DT()
> '
> ' DT Macro
> '
> '
> Dim Document As Word.Document
> Dim Selection As Word.Selection
>
> Set Document = Application.ActiveInspector.WordEditor
> Set Selection = Document.ActiveWindow.Selection
>
> Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
> wdCalendarWestern, InsertAsFullWidth:=False
> Selection.MoveLeft Unit:=wdCharacter, Count:=5
> Selection.TypeBackspace
> Selection.EndKey Unit:=wdLine
> Selection.TypeText Text:=" / "
> Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:=

_
> False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern,

_
> InsertAsFullWidth:=False
> End Sub
>
>
> "Michael Bauer [MVP - Outlook]" wrote:
>
>>
>>
>> Not tested but this might work. Add a reference to Word's library
>> (Tools/References) and insert this at the beginning of your code:
>>
>> Dim Document as Word.Document
>> Dim Selection as Word.Selection
>>
>> Set Document=Application.ActiveInspector.WordEditor
>> Set Selection=Document.ActiveWindow.Selection
>>
>> --
>> Viele Gruesse / Best regards
>> Michael Bauer - MVP Outlook
>> Organize eMails:
>>

<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>>
>> Am Tue, 10 Jul 2007 18:44:01 -0700 schrieb Kevinsm:
>>
>>> Right, thanks Michael, it was a macro created in Word and then able to

be
>>> used in Outlook 2003 since Word was the message editor ... evidently no
>>> longer the case.
>>>
>>> The code is:
>>> Sub DT()
>>> '
>>> ' DT Macro
>>> '
>>> '
>>> Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
>>> InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:=

_
>>> wdCalendarWestern, InsertAsFullWidth:=False
>>> Selection.MoveLeft Unit:=wdCharacter, Count:=5
>>> Selection.TypeBackspace
>>> Selection.EndKey Unit:=wdLine
>>> Selection.TypeText Text:=" / "
>>> Selection.InsertDateTime DateTimeFormat:="h:mm am/pm",

InsertAsField:=
>> _
>>> False, DateLanguage:=wdEnglishUS,

CalendarType:=wdCalendarWestern,
>> _
>>> InsertAsFullWidth:=False
>>> End Sub
>>>
>>> Thanks for your help!
>>>
>>> "Michael Bauer [MVP - Outlook]" wrote:
>>>
>>>>
>>>>
>>>> Outlook never had a macro recorder, probably you're talking about Word.
>>>> What's the code?
>>>>
>>>> --
>>>> Viele Gruesse / Best regards
>>>> Michael Bauer - MVP Outlook
>>>> Organize eMails:
>>>>

>>

<http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>>>>
>>>> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
>>>>
>>>>> In Outlook 2003 I was able to use a macro I had created in Word to

>> insert
>>>> the
>>>>> day, date, and time at the beginning of a new email. Outlook 2007 has

>> no
>>>>> "macro-record" function and my attempt to import a similar macro I

>> created
>>>> in
>>>>> Word 2007 has failed ... when I run it, it results in an error message

>> and
>>>> I
>>>>> have no clue how to debug. Any counsel?
>>>>

>>

 
Reply With Quote
 
=?Utf-8?B?S2V2aW5zbQ==?=
Guest
Posts: n/a
 
      11th Jul 2007
Danke, nein ... I'll research how to do that when I get a moment and let you
know how it works.

"Michael Bauer [MVP - Outlook]" wrote:

>
>
> Did you add a ref to 'Microsoft Word x Object Library'?
>
> --
> Viele Gruesse / Best regards
> Michael Bauer - MVP Outlook
> Organize eMails:
> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>
> Am Tue, 10 Jul 2007 23:26:00 -0700 schrieb Kevinsm:
>
> > I made the change you suggested and I am now getting the following error
> > message:
> > [Microsoft Visual Basic]
> > Compile error:
> > User-defined type not defined
> >
> > By the way following your suggestion, the code now is:
> > Sub DT()
> > '
> > ' DT Macro
> > '
> > '
> > Dim Document As Word.Document
> > Dim Selection As Word.Selection
> >
> > Set Document = Application.ActiveInspector.WordEditor
> > Set Selection = Document.ActiveWindow.Selection
> >
> > Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> > InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
> > wdCalendarWestern, InsertAsFullWidth:=False
> > Selection.MoveLeft Unit:=wdCharacter, Count:=5
> > Selection.TypeBackspace
> > Selection.EndKey Unit:=wdLine
> > Selection.TypeText Text:=" / "
> > Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:=

> _
> > False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern,

> _
> > InsertAsFullWidth:=False
> > End Sub
> >
> >
> > "Michael Bauer [MVP - Outlook]" wrote:
> >
> >>
> >>
> >> Not tested but this might work. Add a reference to Word's library
> >> (Tools/References) and insert this at the beginning of your code:
> >>
> >> Dim Document as Word.Document
> >> Dim Selection as Word.Selection
> >>
> >> Set Document=Application.ActiveInspector.WordEditor
> >> Set Selection=Document.ActiveWindow.Selection
> >>
> >> --
> >> Viele Gruesse / Best regards
> >> Michael Bauer - MVP Outlook
> >> Organize eMails:
> >>

> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >>
> >> Am Tue, 10 Jul 2007 18:44:01 -0700 schrieb Kevinsm:
> >>
> >>> Right, thanks Michael, it was a macro created in Word and then able to

> be
> >>> used in Outlook 2003 since Word was the message editor ... evidently no
> >>> longer the case.
> >>>
> >>> The code is:
> >>> Sub DT()
> >>> '
> >>> ' DT Macro
> >>> '
> >>> '
> >>> Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> >>> InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:=

> _
> >>> wdCalendarWestern, InsertAsFullWidth:=False
> >>> Selection.MoveLeft Unit:=wdCharacter, Count:=5
> >>> Selection.TypeBackspace
> >>> Selection.EndKey Unit:=wdLine
> >>> Selection.TypeText Text:=" / "
> >>> Selection.InsertDateTime DateTimeFormat:="h:mm am/pm",

> InsertAsField:=
> >> _
> >>> False, DateLanguage:=wdEnglishUS,

> CalendarType:=wdCalendarWestern,
> >> _
> >>> InsertAsFullWidth:=False
> >>> End Sub
> >>>
> >>> Thanks for your help!
> >>>
> >>> "Michael Bauer [MVP - Outlook]" wrote:
> >>>
> >>>>
> >>>>
> >>>> Outlook never had a macro recorder, probably you're talking about Word.
> >>>> What's the code?
> >>>>
> >>>> --
> >>>> Viele Gruesse / Best regards
> >>>> Michael Bauer - MVP Outlook
> >>>> Organize eMails:
> >>>>
> >>

> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >>>>
> >>>> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
> >>>>
> >>>>> In Outlook 2003 I was able to use a macro I had created in Word to
> >> insert
> >>>> the
> >>>>> day, date, and time at the beginning of a new email. Outlook 2007 has
> >> no
> >>>>> "macro-record" function and my attempt to import a similar macro I
> >> created
> >>>> in
> >>>>> Word 2007 has failed ... when I run it, it results in an error message
> >> and
> >>>> I
> >>>>> have no clue how to debug. Any counsel?
> >>>>
> >>

>

 
Reply With Quote
 
=?Utf-8?B?S2V2aW5zbQ==?=
Guest
Posts: n/a
 
      11th Jul 2007
After brief research of 'Microsoft Word 2007 Object Library', I can't see
where or how to add a reference. Word 2007 doesn't have Tools/References in
the same way the earlier version did ... any help?

"Michael Bauer [MVP - Outlook]" wrote:

>
>
> Did you add a ref to 'Microsoft Word x Object Library'?
>
> --
> Viele Gruesse / Best regards
> Michael Bauer - MVP Outlook
> Organize eMails:
> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>
> Am Tue, 10 Jul 2007 23:26:00 -0700 schrieb Kevinsm:
>
> > I made the change you suggested and I am now getting the following error
> > message:
> > [Microsoft Visual Basic]
> > Compile error:
> > User-defined type not defined
> >
> > By the way following your suggestion, the code now is:
> > Sub DT()
> > '
> > ' DT Macro
> > '
> > '
> > Dim Document As Word.Document
> > Dim Selection As Word.Selection
> >
> > Set Document = Application.ActiveInspector.WordEditor
> > Set Selection = Document.ActiveWindow.Selection
> >
> > Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> > InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
> > wdCalendarWestern, InsertAsFullWidth:=False
> > Selection.MoveLeft Unit:=wdCharacter, Count:=5
> > Selection.TypeBackspace
> > Selection.EndKey Unit:=wdLine
> > Selection.TypeText Text:=" / "
> > Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:=

> _
> > False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern,

> _
> > InsertAsFullWidth:=False
> > End Sub
> >
> >
> > "Michael Bauer [MVP - Outlook]" wrote:
> >
> >>
> >>
> >> Not tested but this might work. Add a reference to Word's library
> >> (Tools/References) and insert this at the beginning of your code:
> >>
> >> Dim Document as Word.Document
> >> Dim Selection as Word.Selection
> >>
> >> Set Document=Application.ActiveInspector.WordEditor
> >> Set Selection=Document.ActiveWindow.Selection
> >>
> >> --
> >> Viele Gruesse / Best regards
> >> Michael Bauer - MVP Outlook
> >> Organize eMails:
> >>

> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >>
> >> Am Tue, 10 Jul 2007 18:44:01 -0700 schrieb Kevinsm:
> >>
> >>> Right, thanks Michael, it was a macro created in Word and then able to

> be
> >>> used in Outlook 2003 since Word was the message editor ... evidently no
> >>> longer the case.
> >>>
> >>> The code is:
> >>> Sub DT()
> >>> '
> >>> ' DT Macro
> >>> '
> >>> '
> >>> Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> >>> InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:=

> _
> >>> wdCalendarWestern, InsertAsFullWidth:=False
> >>> Selection.MoveLeft Unit:=wdCharacter, Count:=5
> >>> Selection.TypeBackspace
> >>> Selection.EndKey Unit:=wdLine
> >>> Selection.TypeText Text:=" / "
> >>> Selection.InsertDateTime DateTimeFormat:="h:mm am/pm",

> InsertAsField:=
> >> _
> >>> False, DateLanguage:=wdEnglishUS,

> CalendarType:=wdCalendarWestern,
> >> _
> >>> InsertAsFullWidth:=False
> >>> End Sub
> >>>
> >>> Thanks for your help!
> >>>
> >>> "Michael Bauer [MVP - Outlook]" wrote:
> >>>
> >>>>
> >>>>
> >>>> Outlook never had a macro recorder, probably you're talking about Word.
> >>>> What's the code?
> >>>>
> >>>> --
> >>>> Viele Gruesse / Best regards
> >>>> Michael Bauer - MVP Outlook
> >>>> Organize eMails:
> >>>>
> >>

> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >>>>
> >>>> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
> >>>>
> >>>>> In Outlook 2003 I was able to use a macro I had created in Word to
> >> insert
> >>>> the
> >>>>> day, date, and time at the beginning of a new email. Outlook 2007 has
> >> no
> >>>>> "macro-record" function and my attempt to import a similar macro I
> >> created
> >>>> in
> >>>>> Word 2007 has failed ... when I run it, it results in an error message
> >> and
> >>>> I
> >>>>> have no clue how to debug. Any counsel?
> >>>>
> >>

>

 
Reply With Quote
 
Sue Mosher [MVP-Outlook]
Guest
Posts: n/a
 
      11th Jul 2007
PMJI, but Tools | References indeed is the correct command that you need to use in the Outlook VBA environment to add a reference to the Microsoft Word library.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Kevinsm" <(E-Mail Removed)> wrote in message news:81698599-FC6A-4831-B6DF-(E-Mail Removed)...
> After brief research of 'Microsoft Word 2007 Object Library', I can't see
> where or how to add a reference. Word 2007 doesn't have Tools/References in
> the same way the earlier version did ... any help?
>
> "Michael Bauer [MVP - Outlook]" wrote:
>
>>
>>
>> Did you add a ref to 'Microsoft Word x Object Library'?
>>
>> --
>> Viele Gruesse / Best regards
>> Michael Bauer - MVP Outlook
>> Organize eMails:
>> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>>
>> Am Tue, 10 Jul 2007 23:26:00 -0700 schrieb Kevinsm:
>>
>> > I made the change you suggested and I am now getting the following error
>> > message:
>> > [Microsoft Visual Basic]
>> > Compile error:
>> > User-defined type not defined
>> >
>> > By the way following your suggestion, the code now is:
>> > Sub DT()
>> > '
>> > ' DT Macro
>> > '
>> > '
>> > Dim Document As Word.Document
>> > Dim Selection As Word.Selection
>> >
>> > Set Document = Application.ActiveInspector.WordEditor
>> > Set Selection = Document.ActiveWindow.Selection
>> >
>> > Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
>> > InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
>> > wdCalendarWestern, InsertAsFullWidth:=False
>> > Selection.MoveLeft Unit:=wdCharacter, Count:=5
>> > Selection.TypeBackspace
>> > Selection.EndKey Unit:=wdLine
>> > Selection.TypeText Text:=" / "
>> > Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:=

>> _
>> > False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern,

>> _
>> > InsertAsFullWidth:=False
>> > End Sub
>> >
>> >
>> > "Michael Bauer [MVP - Outlook]" wrote:
>> >
>> >>
>> >>
>> >> Not tested but this might work. Add a reference to Word's library
>> >> (Tools/References) and insert this at the beginning of your code:
>> >>
>> >> Dim Document as Word.Document
>> >> Dim Selection as Word.Selection
>> >>
>> >> Set Document=Application.ActiveInspector.WordEditor
>> >> Set Selection=Document.ActiveWindow.Selection
>> >>
>> >> --
>> >> Viele Gruesse / Best regards
>> >> Michael Bauer - MVP Outlook
>> >> Organize eMails:
>> >>

>> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>> >>
>> >> Am Tue, 10 Jul 2007 18:44:01 -0700 schrieb Kevinsm:
>> >>
>> >>> Right, thanks Michael, it was a macro created in Word and then able to

>> be
>> >>> used in Outlook 2003 since Word was the message editor ... evidently no
>> >>> longer the case.
>> >>>
>> >>> The code is:
>> >>> Sub DT()
>> >>> '
>> >>> ' DT Macro
>> >>> '
>> >>> '
>> >>> Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
>> >>> InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:=

>> _
>> >>> wdCalendarWestern, InsertAsFullWidth:=False
>> >>> Selection.MoveLeft Unit:=wdCharacter, Count:=5
>> >>> Selection.TypeBackspace
>> >>> Selection.EndKey Unit:=wdLine
>> >>> Selection.TypeText Text:=" / "
>> >>> Selection.InsertDateTime DateTimeFormat:="h:mm am/pm",

>> InsertAsField:=
>> >> _
>> >>> False, DateLanguage:=wdEnglishUS,

>> CalendarType:=wdCalendarWestern,
>> >> _
>> >>> InsertAsFullWidth:=False
>> >>> End Sub
>> >>>
>> >>> Thanks for your help!
>> >>>
>> >>> "Michael Bauer [MVP - Outlook]" wrote:
>> >>>
>> >>>>
>> >>>>
>> >>>> Outlook never had a macro recorder, probably you're talking about Word.
>> >>>> What's the code?
>> >>>>
>> >>>> --
>> >>>> Viele Gruesse / Best regards
>> >>>> Michael Bauer - MVP Outlook
>> >>>> Organize eMails:
>> >>>>
>> >>

>> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
>> >>>>
>> >>>> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
>> >>>>
>> >>>>> In Outlook 2003 I was able to use a macro I had created in Word to
>> >> insert
>> >>>> the
>> >>>>> day, date, and time at the beginning of a new email. Outlook 2007 has
>> >> no
>> >>>>> "macro-record" function and my attempt to import a similar macro I
>> >> created
>> >>>> in
>> >>>>> Word 2007 has failed ... when I run it, it results in an error message
>> >> and
>> >>>> I
>> >>>>> have no clue how to debug. Any counsel?
>> >>>>
>> >>

>>

 
Reply With Quote
 
=?Utf-8?B?S2V2aW5zbQ==?=
Guest
Posts: n/a
 
      11th Jul 2007
Thanks so much, Sue and Michael ... but it's probably obvious I'm a total
novice in these areas. Any chance of a quick step-by-step instruction as to
how to do what you're indicating?

"Sue Mosher [MVP-Outlook]" wrote:

> PMJI, but Tools | References indeed is the correct command that you need to use in the Outlook VBA environment to add a reference to the Microsoft Word library.
>
> --
> Sue Mosher, Outlook MVP
> Author of Microsoft Outlook 2007 Programming:
> Jumpstart for Power Users and Administrators
> http://www.outlookcode.com/article.aspx?id=54
>
>
> "Kevinsm" <(E-Mail Removed)> wrote in message news:81698599-FC6A-4831-B6DF-(E-Mail Removed)...
> > After brief research of 'Microsoft Word 2007 Object Library', I can't see
> > where or how to add a reference. Word 2007 doesn't have Tools/References in
> > the same way the earlier version did ... any help?
> >
> > "Michael Bauer [MVP - Outlook]" wrote:
> >
> >>
> >>
> >> Did you add a ref to 'Microsoft Word x Object Library'?
> >>
> >> --
> >> Viele Gruesse / Best regards
> >> Michael Bauer - MVP Outlook
> >> Organize eMails:
> >> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >>
> >> Am Tue, 10 Jul 2007 23:26:00 -0700 schrieb Kevinsm:
> >>
> >> > I made the change you suggested and I am now getting the following error
> >> > message:
> >> > [Microsoft Visual Basic]
> >> > Compile error:
> >> > User-defined type not defined
> >> >
> >> > By the way following your suggestion, the code now is:
> >> > Sub DT()
> >> > '
> >> > ' DT Macro
> >> > '
> >> > '
> >> > Dim Document As Word.Document
> >> > Dim Selection As Word.Selection
> >> >
> >> > Set Document = Application.ActiveInspector.WordEditor
> >> > Set Selection = Document.ActiveWindow.Selection
> >> >
> >> > Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> >> > InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:= _
> >> > wdCalendarWestern, InsertAsFullWidth:=False
> >> > Selection.MoveLeft Unit:=wdCharacter, Count:=5
> >> > Selection.TypeBackspace
> >> > Selection.EndKey Unit:=wdLine
> >> > Selection.TypeText Text:=" / "
> >> > Selection.InsertDateTime DateTimeFormat:="h:mm am/pm", InsertAsField:=
> >> _
> >> > False, DateLanguage:=wdEnglishUS, CalendarType:=wdCalendarWestern,
> >> _
> >> > InsertAsFullWidth:=False
> >> > End Sub
> >> >
> >> >
> >> > "Michael Bauer [MVP - Outlook]" wrote:
> >> >
> >> >>
> >> >>
> >> >> Not tested but this might work. Add a reference to Word's library
> >> >> (Tools/References) and insert this at the beginning of your code:
> >> >>
> >> >> Dim Document as Word.Document
> >> >> Dim Selection as Word.Selection
> >> >>
> >> >> Set Document=Application.ActiveInspector.WordEditor
> >> >> Set Selection=Document.ActiveWindow.Selection
> >> >>
> >> >> --
> >> >> Viele Gruesse / Best regards
> >> >> Michael Bauer - MVP Outlook
> >> >> Organize eMails:
> >> >>
> >> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >> >>
> >> >> Am Tue, 10 Jul 2007 18:44:01 -0700 schrieb Kevinsm:
> >> >>
> >> >>> Right, thanks Michael, it was a macro created in Word and then able to
> >> be
> >> >>> used in Outlook 2003 since Word was the message editor ... evidently no
> >> >>> longer the case.
> >> >>>
> >> >>> The code is:
> >> >>> Sub DT()
> >> >>> '
> >> >>> ' DT Macro
> >> >>> '
> >> >>> '
> >> >>> Selection.InsertDateTime DateTimeFormat:="dddd, dd MMMM, yyyy", _
> >> >>> InsertAsField:=False, DateLanguage:=wdEnglishUS, CalendarType:=
> >> _
> >> >>> wdCalendarWestern, InsertAsFullWidth:=False
> >> >>> Selection.MoveLeft Unit:=wdCharacter, Count:=5
> >> >>> Selection.TypeBackspace
> >> >>> Selection.EndKey Unit:=wdLine
> >> >>> Selection.TypeText Text:=" / "
> >> >>> Selection.InsertDateTime DateTimeFormat:="h:mm am/pm",
> >> InsertAsField:=
> >> >> _
> >> >>> False, DateLanguage:=wdEnglishUS,
> >> CalendarType:=wdCalendarWestern,
> >> >> _
> >> >>> InsertAsFullWidth:=False
> >> >>> End Sub
> >> >>>
> >> >>> Thanks for your help!
> >> >>>
> >> >>> "Michael Bauer [MVP - Outlook]" wrote:
> >> >>>
> >> >>>>
> >> >>>>
> >> >>>> Outlook never had a macro recorder, probably you're talking about Word.
> >> >>>> What's the code?
> >> >>>>
> >> >>>> --
> >> >>>> Viele Gruesse / Best regards
> >> >>>> Michael Bauer - MVP Outlook
> >> >>>> Organize eMails:
> >> >>>>
> >> >>
> >> <http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6>
> >> >>>>
> >> >>>> Am Mon, 9 Jul 2007 22:48:00 -0700 schrieb Kevinsm:
> >> >>>>
> >> >>>>> In Outlook 2003 I was able to use a macro I had created in Word to
> >> >> insert
> >> >>>> the
> >> >>>>> day, date, and time at the beginning of a new email. Outlook 2007 has
> >> >> no
> >> >>>>> "macro-record" function and my attempt to import a similar macro I
> >> >> created
> >> >>>> in
> >> >>>>> Word 2007 has failed ... when I run it, it results in an error message
> >> >> and
> >> >>>> I
> >> >>>>> have no clue how to debug. Any counsel?
> >> >>>>
> >> >>
> >>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 Macro (Can't Create Object) cte67 Microsoft Outlook Discussion 1 28th Dec 2010 02:57 PM
Can I create a macro in Outlook 2007? DLGolfs Microsoft Outlook Discussion 1 1st Mar 2010 01:28 PM
Create macro in Outlook 2007 Brandon Microsoft Outlook VBA Programming 4 2nd Jan 2009 01:26 PM
How do I create a new macro in Outlook 2007? Srta Evita Microsoft Outlook 3 20th May 2008 09:09 AM
create Macro, Outlook 2007 - create is grayed out Dave Horne Microsoft Outlook 2 4th Nov 2007 09:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:30 AM.