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