jetzt hab ich aber das Problem in word funktioniert es und in Excel st�rst
es mir komplett ab. =(
bitte um hilfe.
Danke
Manfred
Word.Selection.Find.ClearFormatting
With Word.Selection.Find
.Text = "Test"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Word.Selection.Find.Execute
Word.Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
t = Word.Selection.Tables.Count
> jetzt hab ich aber das Problem in word funktioniert es und in Excel stᅵrst
> es mir komplett ab. =(
Ist recht einfach, Excel kennt die Konstanten nicht die Word kennt und
auᅵerdem weiᅵ ich nicht wie Du die Word-Instanz initialisierst. Daher
bitte das nᅵchste Mal das komplette Makro posten.
Der Code-Schnipsel lᅵuft so ohne Problem.
BTW, heiᅵer Tip bei solchen Aktionen: Immer "Option Explicit" oben
drᅵber schreiben!
Andreas.
Option Explicit
Const wdFindContinue = 1
Const wdStory = 6
Const wdExtend = 1
Sub test()
Dim Word As Object, T As Long
Set Word = GetObject(, "Word.Application")
Word.Selection.Find.ClearFormatting
With Word.Selection.Find
.Text = "Test"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Word.Selection.Find.Execute
Word.Selection.HomeKey Unit:=wdStory, Extend:=wdExtend
T = Word.Selection.Tables.Count
End Sub