+ Reply to Thread
Results 1 to 3 of 3

CommandButton and AutoText

  1. #1
    Registered User
    Join Date
    10-21-2015
    Location
    UK
    MS-Off Ver
    2003
    Posts
    9

    CommandButton and AutoText

    Hello,

    Would be very grateful if somebody could help me with a piece of work I've got stuck on...

    So, I've built a form in Word which has various sections and I'm looking for additional sections to be added when required. To do that, I've inserted a CommandButton into parts of the document and then used AutoText to insert them. This seems to work for any CommandButton that is displayed when the document is created (only two) but any CommandButton that is subsequently displayed, because they are contained within the relevant AutoText, does not work.

    Hopefully this makes sense? I can try and explain better and/or provide screenshots and/or code, if necessary.

    Can anybody help me get CommandButtons added to a document via AutoText working?

    - Adam.
    Last edited by QuannyUK; 11-11-2016 at 01:13 PM. Reason: Solved

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: CommandButton and AutoText

    Presumably you're using an ActiveX Command Button. The problem with that approach is that the macro code for such controls are that they're control-specific. Consequently, if you don't know what name Word will assign to your Command Button before it's inserted, you can't code for it. You may get better results by using a Picture content control, formatted to look like a Command Button, since all content controls in a document can be actioned via a single ContentControlOnEnter macro. At most, all you'll need to do is to assign a title or tag to the content control when adding it to your AutoText, so the ContentControlOnEnter macro can test the title or tag before reacting to just any picture content control.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    10-21-2015
    Location
    UK
    MS-Off Ver
    2003
    Posts
    9

    Re: CommandButton and AutoText

    Thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Using autotext
    By bigtiger1 in forum Excel General
    Replies: 4
    Last Post: 02-27-2014, 05:15 PM
  2. Commandbutton in userform to execute code based on a previous commandbutton choice?
    By michaeljoeyeager in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-20-2012, 03:28 PM
  3. [SOLVED] Autotext in Excel
    By Sue in forum Excel General
    Replies: 2
    Last Post: 11-24-2011, 11:23 AM
  4. VB & autotext
    By rocket0612 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2006, 06:21 AM
  5. [SOLVED] autotext from word to excel
    By Esme Thomas Word - Excel in forum Excel General
    Replies: 1
    Last Post: 12-16-2005, 02:25 PM
  6. AUTOTEXT Feature of Word in Excel
    By Arpit in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-06-2005, 01:05 AM
  7. Can Autotext be used with Excel?
    By Gary Krause in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-27-2005, 02:07 PM
  8. Macro to cut-and-paste Autotext
    By whyloo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2005, 03:23 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1