Hi all
I have been working in a little project for a customer.
It is a simple vfp form where invoices for a particular client are displayed, chosen one at a time and then at the click of a button, using automation, a Word template-based invoice is created.
The client wants a specific format and a .dot was provided.
In my laptop it works very well, but today, when demoing it, I got a "OLE dispatch exception code 0 from Microsoft Word: This method or property is not available because the object refers to a protected area of the document..." error for each form field I tried to fill (I used Word2003 in my laptop, over there they have Word2000, live and learn)
All goes down to this code, a function I call for every formfield:
o = CREATEOBJECT("word.application")
IF llUseSingle
xx = o.Documents.Add(LCDOTPATH + "\XXX.dot")
ELSE
xx = o.Documents.Add(LCDOTPATH + "\YYY.dot")
ENDIF
FILLFIELD(CINVOICEDATE ,DTOC(curinvheader.dteinv))
FILLFIELD(CINVOICENO,curinvheader.invno)
.
.
FUNCTION FILLFIELD(cFieldName,cContent)
o.ActiveDocument.FormFields.Item(cFieldName).Select
INKEY(0.1)
o.Selection.Text = " "
o.Selection.MoveRight(1,1)
.Item(cFieldName).Select
INKEY(0.1)
o.Selection.Text = cContent
ENDFUNC
This code works well on Word2003 with a protected doc, but not in Word2000,
if I unprotect the document, fill fields and re-protect the document, the formfields will be overwritten, and the content will be unmodifiable, which is not good.
Please help, it should be doable, perhaps I'm not using the correct methods/objects.
TIA
Max
...Y soy feliz, bien feliz, asi lo grito;
Mira, que el mundo sepa, que se sepa:
Soy feliz....
...And I'm happy, quite happy, so do I yell it;
Look, so the world knows it, so be known:
I'm happy...
Ismael Rivera "Oye cosita linda"
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only