S
Scott
I have a macro that gets run from Outlook. You open up a meeting
request and hit my macro button and the macro opens up a word template
and pulls info from the meeting request and puts it into a table on my
word document. I have the part working where it puts the text into the
table in the body of the template but I am having problems with
inserting text into a cell in the table in the primary header. The
last line of the macro below is where I am trying to put the text in
with. If you remove wordapp. from the begining of the line the
remainder of the line works fine if called from a macro within word.
When I run this macro from Outlook it tells me "The requested member
of the collection does not exist" When I hover my cursor over
wdHeaderFooterPrimary it shows "Empty" but it shows "1" when in word
VBA. I tried to just enter 1 in the Outlook VBA but that did not work
either.
I would appreciate any help or ideas on how to change this text from
Outlook.
Thanks
Scott
Sub MeetingToWord()
Dim myolapp As Outlook.Application
Dim myinspector As Outlook.Inspector
Dim A As String
Set myolapp = CreateObject("Outlook.Application")
Set myinspector = myolapp.ActiveInspector
'Set MyData = New DataObject 'Used to copy to the clip board
'On Error GoTo 10
A = myinspector.CurrentItem.RequiredAttendees
S = myinspector.CurrentItem.Subject
L = myinspector.CurrentItem.Location
ST = myinspector.CurrentItem.Start
E = myinspector.CurrentItem.End
B = myinspector.CurrentItem.Body
D = E - ST 'Duration of meeting
Set wordapp = CreateObject("Word.Application")
wordapp.Visible = True
If wordapp Is Nothing Then
MsgBox "Couldn't Start Word . . . ."
Else
Set oDoc = wordapp.Documents.Add("H:\Templates\Meeting
Minutes.dot")
End If
'
'Update header Info
'
wordapp.ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(2,
3).Range.Text = "Last Cell"
End sub
request and hit my macro button and the macro opens up a word template
and pulls info from the meeting request and puts it into a table on my
word document. I have the part working where it puts the text into the
table in the body of the template but I am having problems with
inserting text into a cell in the table in the primary header. The
last line of the macro below is where I am trying to put the text in
with. If you remove wordapp. from the begining of the line the
remainder of the line works fine if called from a macro within word.
When I run this macro from Outlook it tells me "The requested member
of the collection does not exist" When I hover my cursor over
wdHeaderFooterPrimary it shows "Empty" but it shows "1" when in word
VBA. I tried to just enter 1 in the Outlook VBA but that did not work
either.
I would appreciate any help or ideas on how to change this text from
Outlook.
Thanks
Scott
Sub MeetingToWord()
Dim myolapp As Outlook.Application
Dim myinspector As Outlook.Inspector
Dim A As String
Set myolapp = CreateObject("Outlook.Application")
Set myinspector = myolapp.ActiveInspector
'Set MyData = New DataObject 'Used to copy to the clip board
'On Error GoTo 10
A = myinspector.CurrentItem.RequiredAttendees
S = myinspector.CurrentItem.Subject
L = myinspector.CurrentItem.Location
ST = myinspector.CurrentItem.Start
E = myinspector.CurrentItem.End
B = myinspector.CurrentItem.Body
D = E - ST 'Duration of meeting
Set wordapp = CreateObject("Word.Application")
wordapp.Visible = True
If wordapp Is Nothing Then
MsgBox "Couldn't Start Word . . . ."
Else
Set oDoc = wordapp.Documents.Add("H:\Templates\Meeting
Minutes.dot")
End If
'
'Update header Info
'
wordapp.ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Tables(1).Cell(2,
3).Range.Text = "Last Cell"
End sub