• Adding to Footer (VBA/Word/97+)

    Author
    Topic
    #407711

    A user normally creates a document from a template with a userform. A bookmarked table is populated with the responses of that userform and this is passed into the header. The document may then be printed or converted to an electronic version (pdf).

    What I am attempting to do is to programatically place a ‘Print date’ in a footer but ONLY for the printed version. The electronic copy should not show this print date.

    I realise the limitation of trying to place a bookmark in the footer and having a userform update it so I don’t think it can be done that way.

    Any suggestions please?

    Viewing 5 reply threads
    Author
    Replies
    • #854997

      I think the way you will need to address this is by using a macro to hijack the print command (FilePrint).

      The macro will have to perform the following steps
      1. Add the date to the footer
      2. Print the file
      3. Remove the date from the footer

      The complication is that Acrobat files are produced by way of a print command too to the macro will have to include working out which printer is being used to make sure the date is not added when the AcrobatDistiller or PDFWriter print drivers are being used.

    • #854998

      I think the way you will need to address this is by using a macro to hijack the print command (FilePrint).

      The macro will have to perform the following steps
      1. Add the date to the footer
      2. Print the file
      3. Remove the date from the footer

      The complication is that Acrobat files are produced by way of a print command too to the macro will have to include working out which printer is being used to make sure the date is not added when the AcrobatDistiller or PDFWriter print drivers are being used.

    • #855006

      Is the idea not to have any user intervention? If the user can be prompted with a simple message box that says “Show the date?” you could do this:

      Add a DATE field to the footer, bookmark it, and then select it and make it hidden text (CTrl+H or Format>Font>Hidden).

      Create a print macro that asks the question and, if the user wants to show the date, selects the bookmark, unhides the selection, prints, and then reselects the bookmark and hides the selected text.

      Does that sound okay? (I am assuming that the Acrobat converter ignores hidden text. I actually don’t know if that is true.)

      • #855063

        It would seem more natural to use a { PRINTDATE } field than a { DATE } field. Although I think it would give the same effective result.

        The option to Print hidden data is separate to the one to show it on screen. If you could persuade your users to configure word so that hidden data is printed but not shown on screen they you could do this with no Macro at all.

        StuartR

        • #855356

          I can’t remember whether we had a thread on this, but does Word update the PRINTDATE before or after it prints?

          (And if “Timeslides” means anything to anyone, you know what DVD I just bought.)

          • #855363

            It took a fairly simple experiment to confirm that { PRINTDATE } is updated before printing.

            StuartR

            • #858077

              Firstly, many thanks for the responses. This is the first chance I have had to respond and read any of the replies. I was without Internet access since Sat (24th July) due to a cable problem that has just been repaired (technician’s finding – the fly-lead signal strength had deteriorated and the new cable modem would not operate at all) plus I had to go to Cairns until last Wednesday night (28th) ( – tough life, but someone had to do it!).

              I will explore all options offered and respond later this weekend after I catch up with work as I am sure that someone else would want this ‘feature’ at some time as more organisations move towards documents being available on the internal intranet but also required to be printed with a date stamp.

              Thanks again everone – although there was no offering from HansV – not that I am complaining; he just seem to have an broad interest in everything!

            • #858078

              Firstly, many thanks for the responses. This is the first chance I have had to respond and read any of the replies. I was without Internet access since Sat (24th July) due to a cable problem that has just been repaired (technician’s finding – the fly-lead signal strength had deteriorated and the new cable modem would not operate at all) plus I had to go to Cairns until last Wednesday night (28th) ( – tough life, but someone had to do it!).

              I will explore all options offered and respond later this weekend after I catch up with work as I am sure that someone else would want this ‘feature’ at some time as more organisations move towards documents being available on the internal intranet but also required to be printed with a date stamp.

              Thanks again everone – although there was no offering from HansV – not that I am complaining; he just seem to have an broad interest in everything!

          • #855364

            It took a fairly simple experiment to confirm that { PRINTDATE } is updated before printing.

            StuartR

        • #855357

          I can’t remember whether we had a thread on this, but does Word update the PRINTDATE before or after it prints?

          (And if “Timeslides” means anything to anyone, you know what DVD I just bought.)

      • #855064

        It would seem more natural to use a { PRINTDATE } field than a { DATE } field. Although I think it would give the same effective result.

        The option to Print hidden data is separate to the one to show it on screen. If you could persuade your users to configure word so that hidden data is printed but not shown on screen they you could do this with no Macro at all.

        StuartR

      • #864636

        I am still to get back to this project but to answer your question –
        Yes, my version of a PDF convertor (CutePDF Writer) does ignore hidden text.

      • #864650

        I am still to get back to this project but to answer your question –
        Yes, my version of a PDF convertor (CutePDF Writer) does ignore hidden text.

    • #855007

      Is the idea not to have any user intervention? If the user can be prompted with a simple message box that says “Show the date?” you could do this:

      Add a DATE field to the footer, bookmark it, and then select it and make it hidden text (CTrl+H or Format>Font>Hidden).

      Create a print macro that asks the question and, if the user wants to show the date, selects the bookmark, unhides the selection, prints, and then reselects the bookmark and hides the selected text.

      Does that sound okay? (I am assuming that the Acrobat converter ignores hidden text. I actually don’t know if that is true.)

    • #855067

      Does the PDFMaker call the FilePrint command? If not, you could intercept that, and before printing, put a PRINTDATE field in the footer.

      Alternately, you could put the field in the footer by hand, as in something like: { IF {DOCVARIABLE printing} True {PRINTDATE}}, and then have the FilePrint intercept change the document variable “printing” to True. Just a thought.

    • #855068

      Does the PDFMaker call the FilePrint command? If not, you could intercept that, and before printing, put a PRINTDATE field in the footer.

      Alternately, you could put the field in the footer by hand, as in something like: { IF {DOCVARIABLE printing} True {PRINTDATE}}, and then have the FilePrint intercept change the document variable “printing” to True. Just a thought.

    Viewing 5 reply threads
    Reply To: Adding to Footer (VBA/Word/97+)

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

    Your information: