D
darshan
Hi,
I am new to VBA, so would appretiate some help.
I am trying to programatically create many word documents from VB.
I have a word template with a few form fields in it, which I open
and substitute whatever I want to into the form fields and save the doc.
(all this i do in a loop)
1. I am not being able to put a form field in the footer.
2. Alternatively, I would also like to set the footer of the word document.
But I am not being able to do that too.
Can anyone pls. tell me how to set the footer of a word document
from a VB code ?
I tried doing some recording which gave me the foll. code
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.TypeText Text:="Header that I want to set"
Selection.MoveDown Unit:=wdScreen, Count:=3
Selection.TypeText Text:="Footer Left text" & vbTab & "Footer center" & vbTab
NormalTemplate.AutoTextEntries("Page X of Y").Insert Where:=Selection. _
Range, RichText:=True
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
On putting this code in the VB form, I am getting an error saying that
Command not available since no word document is open !
(in the vb code, the word application instance is set to NOT visible)
Thanks in advance
Darshan
I am new to VBA, so would appretiate some help.
I am trying to programatically create many word documents from VB.
I have a word template with a few form fields in it, which I open
and substitute whatever I want to into the form fields and save the doc.
(all this i do in a loop)
1. I am not being able to put a form field in the footer.
2. Alternatively, I would also like to set the footer of the word document.
But I am not being able to do that too.
Can anyone pls. tell me how to set the footer of a word document
from a VB code ?
I tried doing some recording which gave me the foll. code
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.TypeText Text:="Header that I want to set"
Selection.MoveDown Unit:=wdScreen, Count:=3
Selection.TypeText Text:="Footer Left text" & vbTab & "Footer center" & vbTab
NormalTemplate.AutoTextEntries("Page X of Y").Insert Where:=Selection. _
Range, RichText:=True
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
On putting this code in the VB form, I am getting an error saying that
Command not available since no word document is open !
(in the vb code, the word application instance is set to NOT visible)
Thanks in advance
Darshan