03-13-2014, 07:43 PM
Hi All,
I came across some sample VBA code for updating a Word form field:
http://www.devhut.net/2010/09/17/vba-wor...rm-fields/
I was trying to do it in QM but unsuccessfully:
I had first defined filepath as a string str but I received this error from QM
So I changed str to VARIANT* which threw an exception but seemed to work when I changed it to just VARIANT without the asterisk.
It then tried to open the document successfully but the next line didn't seem to be the right syntax
FormFields seems to be a read only property and doesn't take the .Result member.
Any thoughts on how to proceed further with setting the text of that field?
Thanks!!!!,
S
I came across some sample VBA code for updating a Word form field:
http://www.devhut.net/2010/09/17/vba-wor...rm-fields/
I was trying to do it in QM but unsuccessfully:
VARIANT* filepath = "C:\SampleDoc.docx"
typelib Word {00020905-0000-0000-C000-000000000046} 8.5
;_s.expandpath(filepath)
Word.Application oApp._create
Word.Document oDoc = oApp.documents.open(filepath)
oApp.Visible = "true"
oDoc.FormFields("PtNameField").Result = "John Doe"
oDoc.Close
;
I had first defined filepath as a string str but I received this error from QM
Quote:Error in Macro: expected VARIANT*
tip: maybe you can use operator & (address) or + (type cast) or @ (string to UTF-16).
So I changed str to VARIANT* which threw an exception but seemed to work when I changed it to just VARIANT without the asterisk.
It then tried to open the document successfully but the next line didn't seem to be the right syntax
FormFields seems to be a read only property and doesn't take the .Result member.
Any thoughts on how to proceed further with setting the text of that field?
Thanks!!!!,
S