Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Thu, 08 Nov 2007 03:30:33 -0800,    group: microsoft.public.word.vba.beginners        back       


Text box test change   
hi all....my code is below...i want to be able to change a certain
word in my document to another but it fails to change the text in the
text box at the top of my page....any help please


Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "firm name"
        .Replacement.Text = "new firm name"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    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.MoveDown Unit:=wdScreen, Count:=4
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
    End With
    With ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientPortrait
        .TopMargin = CentimetersToPoints(2.54)
        .BottomMargin = CentimetersToPoints(4)
        .LeftMargin = CentimetersToPoints(2)
        .RightMargin = CentimetersToPoints(2)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.25)
        .FooterDistance = CentimetersToPoints(0.4)
        .PageWidth = CentimetersToPoints(21)
        .PageHeight = CentimetersToPoints(29.7)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = True
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
        .SectionDirection = wdSectionDirectionLtr
    End With
    Selection.WholeStory
    Selection.Delete Unit:=wdCharacter, Count:=1
    Application.DisplayAutoCompleteTips = True
    NormalTemplate.AutoTextEntries("SFooter.TXT").Insert
Where:=Selection.Range _
        , RichText:=True
    'Selection.TypeBackspace
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

'PrinterNow = ActivePrinter      'Gets current printer
'vIsALetterPrinter = True        'This IS a Letter printer

'vLetterPrinter = "\\LFDATA1\HPC4-1"   'Sets the letter printer name
'vCopyPrinter = "\\LFDATA1\HPC4-1"     'Sets the copy printer
    '
'frmPrinting.Show                'Displays print dialog box

'Call DoSelectPrinter            'Selects the correct printer
'Call DoPageSetup4345            'Selects the correct bins
'Call DoPrinting4345             'Prints the document (& copy if
required)
'Call DoSaving                   'Saves if required

'If PrinterNow <> ActivePrinter Then
'    ActivePrinter = PrinterNow      'Sets default printer back to
original
'End If
End Sub
date: Thu, 08 Nov 2007 03:30:33 -0800   author:   unknown

Re: Text box test change   
Hi Matthew,

see:

http://gregmaxey.mvps.org/VBA_Find_And_Replace.htm

http://word.mvps.org/faqs/customization/replaceanywherecontent.htm

-- 
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
date: Thu, 08 Nov 2007 12:53:56 +0100   author:   Helmut Weber

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us