Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
typelib Word Search and Replace
#1
I am trying to do several search and replaces for a form we use in Microsoft Word using typelib. After a lot of searching on the forums, I am close. For example I would like to replace Not Applicable with Applicable. I would like not to use the clipboard but will if necessary. I also found that I could use key strokes after word was activated. There is a better way that I am not getting! Anyone have any ideas?

Macro test
Code:
Copy      Help
typelib Word {00020905-0000-0000-C000-000000000046} 8.5
Word.Document x._getfile("D:\Test.doc")
Word.Application app=x.Application
Word.Range r
app.Visible = TRUE
r=x.Range
VARIANT na="Not Applicable"
r.Find.Execute(na)
r.Select
r.Paste
#2
OK here are two links that are relevant . I cannot get them to work in qm! I am doing something wrong.
http://msdn.microsoft.com/en-us/library/...37675.aspx
http://msdn.microsoft.com/en-us/library/...s.80).aspx
#3
Macro Macro1961
Code:
Copy      Help
;/exe 1
typelib Word {00020905-0000-0000-C000-000000000046} 8.5
;typelib Word {00020905-0000-0000-C000-000000000046} 8.0
Word.Application app._getactive
app.Activate
key CH ;;Ctrl+Home

app.Selection.Find.ClearFormatting()
app.Selection.Find.Text = "find me"
app.Selection.Find.Replacement.ClearFormatting()
app.Selection.Find.Replacement.Text = "Found"
VARIANT vReplace=Word.wdReplaceAll
app.Selection.Find.Execute(@ @ @ @ @ @ @ @ @ @ vReplace)


;BEGIN PROJECT
;main_function  Macro1961
;exe_file  $my qm$\Macro1961.qmm
;flags  6
;guid  {9B9056FA-AA80-4230-B32F-D7CFE96B0668}
;END PROJECT
#4
Thanks Gintaras you giving me the conversion from the example I was using help tremendously with the rest of my code!


Forum Jump:


Users browsing this thread: 1 Guest(s)