Thursday, 15 March 2012

excel - VBA fix .Text .Replace in code -


The code below opens a word doctor (work), then I want to '438' my project error, 'object this Does not support property or method! Cheers! Object set ObjWord = CreateObject ("Word.Application") objWord.Visible = True objWord.Documents.Open "C: \ ..." with obz word as

  sub-open wordfile ( ) Dim Observalde Find out. Text = "AAA". Replacement. Text = "BBBB" end with sub  

See document here:. Available from Find Selection and Range objects. You are trying to access it with an example of Word. You first need to define the selection or range and access it from there.

Take a look at the example code in the documentation, but you do something like (to make the sample code habitable for your use case), so that myRange.Find shows that object What you are looking for:

  set myRange = ActiveDocument Change: mysmile.find.Execute FindText: = "aaa", Replacewith: = "bbbb", Replace: = wdReplaceAll  

No comments:

Post a Comment