I am using a form in vb that has a print command button. This pulls up a word doc with text from my form's textboxes. It works fine except in this 'if then' instance. I don't understand why it doens't work. When I place a breakpoint in the code and walk through it, I can see with the text tool tip box that my variable has the right text in, but it will not appear on the word document. It is just blank. Can anybody help?
Code:strlotarea = Text1(12).Text Set objWdApp = New Word.Application Set objWdDoc = objWdApp.Documents.Open(FileName:="\\Taft\gis\test.doc") Set objwdRange = objWdDoc.Content With objwdRange.Find .Replacement.ClearFormatting .Text = "lotarea" .Replacement.Text = strlotarea ‘works fine .Execute Replace:=wdReplaceAll If Text1(6).Text = "R6" Then strlotarea = "6,000" objwdRange.Find.Text = "lotarea" objwdRange.Find.Replacement.Text = strlotarea ‘left blank on doc. objwdRange.Find.Execute Replace:=wdReplaceAll End If




Reply With Quote