A problem with MS Word document manipulation

Hi,

I practice with editing MS Word document file, to gain some experience.

I have doc file with some text and want to locate a string and replace its value. I try it this way:

Dim msword As Variant

Set msword = createobject("Word.Application")

msword.visible = True

msword.documents.open("C:\Cv-test.doc")



Dim docrange As Variant

Set docrange = msword.activedocument.content

docrange.find.clearformatting

With docrange.find

	.Text = "imieinazwisko"

	.Replacement.Text = "Michał Golba"

	.Forward = True

	.Wrap = wdFindContinue

	.Format = False

	.MatchCase = False

	.MatchWholeWord = False

	.MatchWildcards = False

	.MatchSoundsLike = False

	.MatchAllWordForms = False

End With

docrange.find.execute

but it doesn’t work. What have i done wrong?

Regards,

M.G.

Subject: A problem with MS Word document manipulation

Oh, I almost forgot…

I modified the source from recording a macro.

Regards

M.G.