title image


Smiley Re: Word/OLE-Automatisierung: Suchen und Ersetzen in Kopf- und Fußzeile
Hallo Fritz,Warum es so ist, weiß ich nicht.Ich glaube man muß mitobj.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeaderbzw.obj.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeaderin die "Kopfansicht" wechseln und dann ersetzen:Private Sub Befehl0_Click() Dim oApp As Object On Error GoTo create_word Set oApp = GetObject(, "Word.Application") GoTo weiter create_word: Set oApp = CreateObject("Word.application")weiter: On Error GoTo Err_word With oApp .Visible = True .Documents.Open "C:\Test.Doc" .Activate .WindowState = 1 With .Selection.Find .Text = "Zuersetzendes" .Replacement.Text = "Ersetztes" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With .Selection.Find.Execute Replace:=wdReplaceAll .ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader With .Selection.Find .Text = "Zuersetzendes" .Replacement.Text = "Ersetztes" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With .Selection.Find.Execute Replace:=wdReplaceAll ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter With .Selection.Find .Text = "Zuersetzendes" .Replacement.Text = "Ersetztes" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With .Selection.Find.Execute Replace:=wdReplaceAll .ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument End WithExit_word: Set oApp = NothingExit SubErr_word: MsgBox Err.Description Resume Exit_wordEnd SubGrußWalter

geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: