![]() |
|
|
|
#1
|
|||
|
|||
|
Hi
Hope this can be done is Word etc (I can in LibreOffice etc). I wish to use many command buttons in a document, these buttons basically control external hardware. I would need to call a VBA code that gets the caption from the sending button and then send this caption to a shell program. I can create a button, but I cannot assign any events as such, I can create the code; but this for each button. I would like to be able to copy paste a button, and just change the caption for the new button for it to work. I cannot find a way to use a custom macro with the button click event. Button I am using, is Legacy CommandButton Hope that makes sense. |
|
#2
|
||||
|
||||
|
Select Design Mode from the Controls group. Right click the button > View Code. Use that code to call your macro.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
Hi
Thanks for your reply, but that is doing exactly what I do not want to do. I would like to be able to copy and paste a button, then change its caption and then for it to work, without having to go in and change the code. I have also found no way for the code to interrogate the sending buttons properties as the application.caller does not appear to be available in word, yet is in excel
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find word then call signature macro | Dave T | Word VBA | 4 | 03-28-2016 11:18 PM |
Word 2013: Hotkey to call a macro
|
arjfca | Word | 2 | 12-04-2014 12:53 AM |
Need help with sorting a column by most common to least common
|
mikenmike0001 | Excel | 5 | 12-06-2011 05:17 PM |
Call Macro from Input Box String
|
Paulsh | Word VBA | 1 | 11-01-2011 03:15 AM |
How do I call/execute an Excel macro from Access 2003
|
KramerJ | Excel | 2 | 05-11-2009 11:33 AM |