Set WordDoc = WordApp.Documents.Open(path) Set Selection=wordApp.selection 'Replace content Selection.WholeStory Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "[Name]" .Replacement.Text = "Müller" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute wdReplaceAll Next
Const wdBackground=True Const wdAppend=False Const wdRange=0 Const wdOutputFileName=False Const wdFrom="" 'auch schon 1 versucht Const wdTo="" 'auch schon 1 versucht Const wdItem=0 Const wdPages="" Const wdPageType=0 Const wdPrintToFile=False Const wdCollate=True Const wdFilename="" Const wdActivePrinterMacGX=False Const wdManualDuplexPrint=False Const wdPrintZoomColumn=0 Const wdPrintZoomRow=0 Const wdPrintZoomPaperWidth=0 Const wdPrintZoomPaperHeight=0 wordapp.PrintOut _ wdBackground,_ wdAppend,_ wdRange,_ wdOutputFileName,_ wdFrom,_ wdTo,_ wdItem,_ copies,_ wdPages,_ wdPageType,_ wdPrintToFile,_ wdCollate,_ wdFilename,_ wdActivePrinterMacGX,_ wdManualDuplexPrint,_ wdPrintZoomColumn,_ wdPrintZoomRow,_ wdPrintZoomPaperWidth,_ wdPrintZoomPaperHeight
2. Problem:Const wdBackground=TrueConst wdAppend=FalseConst wdRange=0Const wdOutputFileName=FalseConst wdFrom="" 'auch schon 1 versuchtConst wdTo="" 'auch schon 1 versuchtConst wdItem=0Const wdPages=""Const wdPageType=0Const wdPrintToFile=FalseConst wdCollate=TrueConst wdFilename=""Const wdActivePrinterMacGX=FalseConst wdManualDuplexPrint=FalseConst wdPrintZoomColumn=0Const wdPrintZoomRow=0Const wdPrintZoomPaperWidth=0Const wdPrintZoomPaperHeight=0wordapp.PrintOut _ wdBackground,_ wdAppend,_ wdRange,_ wdOutputFileName,_ wdFrom,_ wdTo,_ wdItem,_ copies,_ wdPages,_ wdPageType,_ wdPrintToFile,_ wdCollate,_ wdFilename,_ wdActivePrinterMacGX,_ wdManualDuplexPrint,_ wdPrintZoomColumn,_ wdPrintZoomRow,_ wdPrintZoomPaperWidth,_ wdPrintZoomPaperHeight
Sub printdocument() ' ' printdocument Macro ' Macro recorded 16.12.2005 by u19292 ' Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _ wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _ ManualDuplexPrint:=False, Collate:=True, Background:=True, PrintToFile:= _ False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 End Sub
Sub findandreplace() ' ' findandreplace Macro ' Macro recorded 05.12.2005 by u19292 ' Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "[Name]" .Replacement.Text = "Müller" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub