Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2007

Tip: Looking for answers? Try searching our database.

Macro assitance for Letterhead

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ted Hansen - 14 Nov 2007 05:32 GMT
Good evening hope this is the right forum for this type of quesiton...
   
I have a letterhead template with a different first page than the subsequent pages. I have attempted to automate my letterhead, so I can add it after I have completed the verbiage from a blank document via a macro.

When I use the macro, it only reapeats the first page letterhead over and over instead of switching over to the subsequent pages that are already in the template I built.

When I use a macro I built to remove the letterhead from a document I created from within the original "letterhead" template only the first page deletes and all subsequent pages keep the second page formatting (trying to make it blank).

I followed everything as laid out in the site below, but feel that I am missing something.

http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=528a

--- CODE For MACRO I have recorded is below ---

******INSERT LOGO******

Sub InsertLogo()
'
' InsertLogo Macro
' Macro recorded 10/17/2007 by angeli
'
   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
   Application.DisplayAutoCompleteTips = True
   With AutoCorrect
       .CorrectInitialCaps = True
       .CorrectSentenceCaps = True
       .CorrectDays = True
       .CorrectCapsLock = True
       .ReplaceText = True
       .ReplaceTextFromSpellingChecker = True
       .CorrectKeyboardSetting = False
       .DisplayAutoCorrectOptions = True
       .CorrectTableCells = True
   End With
   ActiveDocument.AttachedTemplate.AutoTextEntries("Logo").Insert Where:= _
       Selection.Range, RichText:=True
   Application.DisplayAutoCompleteTips = True
   With AutoCorrect
       .CorrectInitialCaps = True
       .CorrectSentenceCaps = True
       .CorrectDays = True
       .CorrectCapsLock = True
       .ReplaceText = True
       .ReplaceTextFromSpellingChecker = True
       .CorrectKeyboardSetting = False
       .DisplayAutoCorrectOptions = True
       .CorrectTableCells = True
   End With
   ActiveDocument.AttachedTemplate.AutoTextEntries("LogoBar").Insert Where:= _
       Selection.Range, RichText:=True
   If Selection.HeaderFooter.IsHeader = True Then
       ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
   Else
       ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
   End If
   Application.DisplayAutoCompleteTips = True
   With AutoCorrect
       .CorrectInitialCaps = True
       .CorrectSentenceCaps = True
       .CorrectDays = True
       .CorrectCapsLock = True
       .ReplaceText = True
       .ReplaceTextFromSpellingChecker = True
       .CorrectKeyboardSetting = False
       .DisplayAutoCorrectOptions = True
       .CorrectTableCells = True
   End With
   ActiveDocument.AttachedTemplate.AutoTextEntries("LogoFooter").Insert Where _
       :=Selection.Range, RichText:=True
   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
End Sub

******REMOVAL OF LOGO******

Sub RemoveLogo()
'
' RemoveLogo Macro
' Macro recorded 10/17/2007 by angeli
'
   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.WholeStory
   Selection.Delete Unit:=wdCharacter, Count:=1
   If Selection.HeaderFooter.IsHeader = True Then
       ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
   Else
       ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
   End If
   Selection.WholeStory
   Selection.Delete Unit:=wdCharacter, Count:=1
   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
End Sub
Astrid - 15 Nov 2007 02:34 GMT
Hi Ted,

I don't understand you exactly:

- are you using this macro inside a document that has a different first page
header defined?
- does the logo show on all pages but the first (if so, on what page is the
cursor if you start the macro?)
I can't open the URL you provided, what exactly does your macro need to do,
add the logo to only the first page?

> Good evening hope this is the right forum for this type of quesiton...
>    
[quoted text clipped - 115 lines]
>     ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
> End Sub
Russ - 15 Nov 2007 18:39 GMT
This is the link Ted meant to post:
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=528

> Hi Ted,
>
[quoted text clipped - 136 lines]
>>     ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
>> End Sub

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.