mciing7912
Programmer
HI guys, I tried to look into this forum something related to this but I couldn't so, here's my problem:
I created a VB application. This program evaluates what products a user has selected and based on that, open a word document previously created by me(template note).
in this word document, I have included all my warranty policies so, if a user just select the product 2, I open the document, search warranty text for product 1(it will be erased because I just need to leave warranty for product 1) and start to select the text belongs to this warranty(41 lines after header):
.Selection.Find.ClearFormatting
.Selection.Find.Text = "WARRANTY PRODUCT 1"
.Selection.Find.Replacement.Text = ""
.Selection.Find.Forward = True
.Selection.Find.Execute
.Selection.MoveDown Unit:=wdLine, Count:=41, Extend:=wdExtend
.Selection.Delete
the problem with this code is, in some cases deletes more than 41 lines or other cases less. I tested same code in different computers and each one has a different behavior.
has someone experimented this behavior???
also, in some cases, if your creating a word document and don't show the document in screen(WordReport.Application.Visible = True) at the beginning, this weird behavior is worst. obviously, I don't want to show the document until my program finishes its work because maybe, the user can press any key without intention...
thanks
I created a VB application. This program evaluates what products a user has selected and based on that, open a word document previously created by me(template note).
in this word document, I have included all my warranty policies so, if a user just select the product 2, I open the document, search warranty text for product 1(it will be erased because I just need to leave warranty for product 1) and start to select the text belongs to this warranty(41 lines after header):
.Selection.Find.ClearFormatting
.Selection.Find.Text = "WARRANTY PRODUCT 1"
.Selection.Find.Replacement.Text = ""
.Selection.Find.Forward = True
.Selection.Find.Execute
.Selection.MoveDown Unit:=wdLine, Count:=41, Extend:=wdExtend
.Selection.Delete
the problem with this code is, in some cases deletes more than 41 lines or other cases less. I tested same code in different computers and each one has a different behavior.
has someone experimented this behavior???
also, in some cases, if your creating a word document and don't show the document in screen(WordReport.Application.Visible = True) at the beginning, this weird behavior is worst. obviously, I don't want to show the document until my program finishes its work because maybe, the user can press any key without intention...
thanks