Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Selecting a shape to put in the footer (MS Word 2003)

    Hi All,

    before I expend lots of effort faffing about with Shapes in VBA (and I have faffed about enough in the past), I would like to ask advice here in the hope that I can start off in the right direction.

    I currently have a template which has a company logo in the footer, on alternate sides for even and odd pages (double sided document) and positioned relative to the margin. I have used the "Alternative Text" property to identify the logo as the company logo, as opposed to a partner's logo which can be optionally added to the other side of the page, also in the footer, by the user.

    I have all the code for the user to select a partner's logo if they wish (from hard disk), and then insert this into the footer, positioned relative to the margin on the opposite side to the company logo. I have the code to remove the partner logo from the document if so wished, by identifying all those Shapes in the footer which are NOT identified as the company logo via the "Alternative Text" property.

    Now my company has stupidly been split into two companies and i have the task of updating my template macros to enable the user to choose which branding (i.e. company logo) they wish to use, as well as being able to choose a partner logo.

    So.. how do I go about doing this? Should I add both possible company logos to the footer in the template, in the same position, with one (identified through the "Alternative Text" property) invisible and the other visible? If the user chooses the other option, then i simply reverse the visibility? Or is there a better way of doing it (I can't think of one).

    Setting up the "Alternative" text value is a bit fiddly in this case, and is prone to errors if the user manually removes and re-adds the logo to the document (the Alternative Text property will no longer be recognisable by my code as a company logo) - this will cause errors if the user wishes to change the branding (unlikely) once a document has been started.

    Any pointers before I dig in?

    cheers

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Selecting a shape to put in the footer (MS Word 2003)

    Keeping both company logos in the footer increases the file size of the documents. How much depends on the logos of course.

    Since you're using code, you might use the Name property of the shape instead of its Alternative Text property. You can set and read this property using VBA.
    If the user manually replaces a shape, the name you assigned will be lost.

    You could protect the document for forms, with all sections unprotected. The user can freely edit the text in the body of the document, but can't edit headers and footers. Your code can unprotect the document, manipulate the footer, then reprotect the document again.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Selecting a shape to put in the footer (MS Word 2003)

    Hi HansV,

    thanks for the ideas. The main issue is: where can I store the two possible logos from which one will be chosen and placed in the footer? I have the code to be able to insert the logo in the footers, the problem is where the two logos are stored and how they are then passed as a shape to the functions which will place them in the footers. Losing the names through the user manually fiddling is a secondary issue to be honest.

    Is the only possibility to hide one of the logos in the footer? Or can I have an pool of logos somewhere in the document, from which one can be chosen and put in the footer? Can I keep the logo images in a form, for example?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Selecting a shape to put in the footer (MS Word 2003)

    You could store the logos as AutoText entries in the template used to create the documents. As long as the document is attached to the template, you can insert a logo, both interactively and using code.
    If the template isn't available (for example if you send the document to someone outside the company), the logo in the footer isn't affected but you won't be able to insert a different logo. But I assume that won't be a problem.

    Or you could store the logos on a shared network folder. The same as above would hold if you send a document outside the company.

  5. #5
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Selecting a shape to put in the footer (MS Word 2003)

    ok.. sounds an interesting concept!.. how can I store the logos as autotext entries (oh, and how do I retrieve them again!). I assume I can only do this using code.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Selecting a shape to put in the footer (MS Word 2003)

    AutoText entries can be created and retrieved both interactively and using code.

    Create interactively:
    - Insert a logo in the footer.
    - Select it.
    - Select Insert | AutoText | AutoText...
    - Select the template where you want to store it from the dropdown near the bottom of the dialog.
    - If you select Normal.dot, the autotext entry will be available in all documents.
    - Specify a name and click Add.

    Insert interactively:
    - Type the name of the entry and press F3, or
    - Select Insert | AutoText | Header/Footer | name of the entry.

    Create using VBA is usually not needed since you have to do it only once.

    Insert using VBA:

    ActiveDocument.AttachedTemplate.AutoTextEntries("n ameofentry").Insert _
    Where:=Selection.Range, RichText:=True

    If you stored the autotext entries in Normal.dot, you can use NormalTemplate instead of ActiveDocument.AttachedTemplate.

  7. #7
    2 Star Lounger
    Join Date
    Oct 2007
    Posts
    172
    Thanks
    0
    Thanked 2 Times in 1 Post

    Re: Selecting a shape to put in the footer (MS Word 2003)

    Hi Hans,

    thanks for the tip - I think this is going to work. It's just what I was looking for: a place to store the images hidden away in the document somewhere.

    cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •