Method or Data Memeber Not Found for Replacement Method

  • Thread starter Thread starter Jonas
  • Start date Start date
J

Jonas

I have created some code that obtains data from the internet and puts
it into a word document. I want to replace all of the double quote
marks with nothing. When I try to run the code that I have now, I get
a message that says, "Method or data member not found." Below is the
code that I have. I've already checked references. Replacement is in
the Word library. I can get the code that I have to write over what I
dump into the word document via the line .Selection.Text = """" but I
just can't figure out why I get an error at replacement. I can get
the section code of code that finds and replaces to work directly in
Word. Do you see what I am not doing correctly? Your feedback is
appreciated.

With objWord
'Make the application visible.
.Visible = True

'Open the document and dump in data
.Documents.Open ("C:\temp\monkey.doc")
.Selection = readText
.Selection.Text = """"
.Selection.Replacement.Text = ""
.Selection.Find.Execute Replace:=wdReplaceAll

End With
 
Jonas said:
I have created some code that obtains data from the internet and puts
it into a word document. I want to replace all of the double quote
marks with nothing.
<SNIP>

Why not do the replacement in the code that pushes the text into Word? You
can use the Replace function:

strInput = Replace(strInput, Chr(34), vbNullString)

_then_ transfer to Word.
 
Back
Top