S
Stacy
I am new at this and trying to create a macro in work that will insert a new
appendix cover sheet in a report template. Allowing the user to type the
Appendix letter and name to display for the title and footer. How do I get
the InputBox data entered to appear in my Word document?
See code below. Or is it totally off?
Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.TypeText Text:="Appendix "
MyValue = InputBox("Type Letter of Appendix", "Insert Appendix")
Selection.TypeText Text:=": "
Message = "Type Name of the Appendix"
Title = "Insert Appendix Name"
MyValue = InputBox(Message, Title)
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Style = ActiveDocument.Styles("TOC Title")
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
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
Selection.EndKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
LinkToPrevious
Selection.MoveLeft Unit:=wdCharacter, Count:=3
Selection.TypeBackspace
Message = "Type Letter of Appendix"
Title = "Insert Appendix Letter in Footer"
MyValue = InputBox(Message, Title)
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Function
appendix cover sheet in a report template. Allowing the user to type the
Appendix letter and name to display for the title and footer. How do I get
the InputBox data entered to appear in my Word document?
See code below. Or is it totally off?
Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdSectionBreakNextPage
Selection.TypeText Text:="Appendix "
MyValue = InputBox("Type Letter of Appendix", "Insert Appendix")
Selection.TypeText Text:=": "
Message = "Type Name of the Appendix"
Title = "Insert Appendix Name"
MyValue = InputBox(Message, Title)
Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
Selection.Style = ActiveDocument.Styles("TOC Title")
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
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
Selection.EndKey Unit:=wdStory
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.HeaderFooter.LinkToPrevious = Not Selection.HeaderFooter. _
LinkToPrevious
Selection.MoveLeft Unit:=wdCharacter, Count:=3
Selection.TypeBackspace
Message = "Type Letter of Appendix"
Title = "Insert Appendix Letter in Footer"
MyValue = InputBox(Message, Title)
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Function