473,378 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

VB.NET and MS Word Find and Replace Error

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:=wdReplaceA ll)

Dec 9 '06 #1
1 5128
Hello,

I have exactly the same problem. Have you found the reason yet ?

Thanks,
Erwin Speltincx

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Dec 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

41
by: Ruby Tuesday | last post by:
Hi, I was wondering if expert can give me some lite to convert my word table into access database. Note: within each cell of my word table(s), some has multi-line data in it. In addition, there...
0
by: David Krmpotic | last post by:
Regards, I need a little explanation in converting word VB macros to charp code! first, I recorded simple macro which replaces every occurence of one word in whole document (is it?) , here:...
1
by: adam lital | last post by:
Hi, I have word document and i want to replace a specific text with a bookmark using code. Example: in the document i have the text and i want to replace this to a bookmark called ClientName....
1
by: James Vitale | last post by:
Using vb asp.net 1.1 I'm doing a word automation on a doc file and trying to do a find and replace. My existing code works fine except that it doesn't find and replace in the header. My code...
8
by: John Salerno | last post by:
I figured my first step is to install the win32 extension, which I did, but I can't seem to find any documentation for it. A couple of the links on Mark Hammond's site don't seem to work. ...
2
by: Ola K | last post by:
Hi guys, I wrote a script that works *almost* perfectly, and this lack of perfection simply puzzles me. I simply cannot point the whys, so any help on it will be appreciated. I paste it all here,...
1
by: Jordan | last post by:
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...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: asedt | last post by:
I have problem creating a private sub to replace text in a wordfile, is the use of ByRef good? The problem is that this works on my developing computer but not at the target computers. Private...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.