Board index » Visual Studio » VB.NET and MS Word Find and Replace Error
|
CyberData2
|
VB.NET and MS Word Find and Replace Error
Visual Studio97
Hi. I am autoamtiacally creating a MS Word file through code. Most of my code works, but when I try to do a find and replace, I get a read/write memrory access error. Not sure what is going on. Any advice? Error occurs on the .Text line of the with block Public wordapp As New Microsoft.Office.Interop.Word.Application Public doc As New Microsoft.Office.Interop.Word.Document With wordapp.Selection.Find .Text = "[" & Trim(strField) & "]" .Replacement.Text = Trim(strReplacementText) .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With wordapp.Selection.Find.Execute(Replace:=wdReplaceAll) - |
