passing variables from excel to word
Hi Mike,
In the Word VBA code, you can use oDoc.Variables('Product") or
oDoc.Variables('Product").Value (though the value is not really necessary
because it is the default property of a Variable. Having does maybe make
the code a bit easier to understand )
The variables do not have to appear anywhere in the document if you don't
want them to, so you can leave the value in them. If you do want to display
the value of the variable in the document, you do so by use of a {
DOCVARIABLE "Product" } field.
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a consulting basis.
Hope this helps
Doug Robbins - Word MVP
"Mike NG" wrote in message
...
On Sat, 19 Jul 2003 at 08:55:55, John Green (John Green
) wrote:
Mike,
If you are trying to insert data into your Word document, I recommend
using document variables.
You can place fields in your document such as {DOCVARIABLE Product}
In your code you can assign values to the variables:
oDoc.Variables("Product") = "Oranges"
While that sounds cool, is there any way of passing variable into the
code section of the VBA in the word document from the code of excel?
I assume that once in the word document, I can read them into the VBA
code, and then set them to null, because I take it that all DOCVARIABLES
in the word document must appear in the page-
--
Mike
|