Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-16-2011, 06:28 PM
TessaLee TessaLee is offline footer macro Windows 7 64bit footer macro Office 2007
Novice
footer macro
 
Join Date: Mar 2011
Posts: 6
TessaLee is on a distinguished road
Default footer macro

I created a macro to select text from a Word document and insert it into a footer by recording key strokes and mouse clicks. It's failing when pasting the selected text into the footer. Does anyone know what's wrong?

Selection.HomeKey Unit:=wdStory


Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Cut
WordBasic.ViewFooterOnly
ActiveDocument.AttachedTemplate.BuildingBlockEntri es(" Blank").Insert _
Where:=Selection.Range, RichText:=True
Selection.PasteAndFormat (wdPasteDefault)
Reply With Quote
  #2  
Old 03-20-2011, 03:55 AM
macropod's Avatar
macropod macropod is offline footer macro Windows 7 32bit footer macro Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi TessaLee,

Try something along the lines of:
Code:
Sub AddFooter()
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range.Text = Selection.Text
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
footer macro add footer TessaLee Word 1 03-15-2011 04:14 AM
footer macro Dynamic footer WalterinOz Word 1 12-22-2010 11:08 PM
Different Header but same Footer Karthick Word 1 11-12-2010 09:08 AM
Filename in footer Dixon Word 3 09-24-2009 09:12 AM
Header and footer questions boutells Word 0 07-21-2009 01:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft