none
error! no document variable supplied from word 2007 RRS feed

  • Question

  • I have a word 2007 document where I'm trying to replace document variables in the header with text from another app thru VBA. But when I try to create the document variable in word with Quick Parts / Field, it errors immediately when I enter the doc variable name in the header field. The field in the header is addressline1. I select that and go to quick parts, field. I select DocVariable and in field codes I enter addressline1 or DOCVARIABLE "addressline1". Either way, when I hit enter the header line it changes to "Error! No document variable supplied". The VBA code behind this already has the variable name defined in it.

    The first parameter coming into the VBA sub is "address1 as string".
    The setting of the variable is like this in the document named data_report.

    data_report.Variables.Add NAme:="addressline1", value:=address1

    What am I missing?

    


    microwave tech

    Monday, September 24, 2012 10:06 PM

Answers