• IncludePicture with DocVariable

    Author
    Topic
    #475796

    Hi All,

    I’m trying to use a DocVariable with an IncludePicture field in a template. My field code looks like this:

    { INCLUDEPICTURE “{ DOCVARIABLE MyImage }” }

    and my code looks like this:

    ActiveDocument.Variables(“MyImage”) = lblMyImage (where lblMyImage would contain z:\templates\images\img1.gif or whatever the user selects in a form from a dropdown box)

    The problem isn’t with the code, though, it’s with the behavior of Word 2003. For some reason, when I try to save the template, it replaces the { DOCVARIABLE MyImage } with the location of the template on my c drive, so I get { INCLUDEPICTURE “c:\MyDesktop\Template.dot” } instead of the docvariable that I want to save.

    Any ideas on what I might be doing wrong? I’ve gone through the menus under Tools–>Options and all the tabs and unchecked anything that I thought might update the docvariable automagically, but it still reverts. I’ve tried recreating the field codes over and over, sometimes using the toolbar to automatically insert them, and other times using F9, but there appears to be no difference.

    Incidentally, there are other docvariables in the template that don’t behave like this, but they’re not related to an IncludePicture field.

    Viewing 1 reply thread
    Author
    Replies
    • #1274207

      What happens when you select the field and update it? If this works but saving breaks it then I would suspect that you have a macro called FileSave that is causing the issue.

      If this is not the case, can you post a cut down version of your template which includes the field you are having problems with?

      • #1274216

        Hi Ceceilia
        I created a form with a text box to store the path to the pic.
        Important that I included the double slash in pathname

        The OK click created the docVariable and populated it with contents of textbox.
        The images show the field codes and the results.
        It seemed to work.

        Enjoy
        Geof

    • #1274213

      After hours of searching and lots of frustration, I stumbled upon someone else who encountered this quirk of Word 2003.

      http://help.lockergnome.com/office/IncludePicture-rendering-save-source-document–ftopict949037.html

      From the Tools menu, select Options and then on the General tab, click on
      Web Options and then select the Files tab and uncheck the option to Update
      links on save.

      Turning this off solved my problem.

    Viewing 1 reply thread
    Reply To: IncludePicture with DocVariable

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: