#1
|
|||
|
|||
Add field based on excel data with keyboard shortcut
Hi, is it possible to create a keyboard shortcut to add a field based on a excel columm and then choose the info i want with a dropdown? Every day a make documents with lots of names and numbers, ex: peter n.º1234 John n.º4321 Hector n.3333 If i can simplify my live using a keyboard shortcut to add the field and choose the name i want it will be amazing. thanks |
#2
|
||||
|
||||
See, for example: https://www.msofficeforums.com/word-...html#post46287
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Populate Dropdown List from Excel
Hi,
i'm trying to do the same thing as in https://www.msofficeforums.com/word-...drop-down.html but without sucess. i've created the excel file wiht lots of names in the first columm. I've created the macro and paste the code on the #2 post and set the reference in the macro. Now how can i call the macro to show me the dropdown with the list of excel file? Thank you |
#4
|
||||
|
||||
I take it you added the macro to the Word document, not to the Excel workbook. The macro runs automatically when you open the document - no user action is required. For it to work with the macro as coded, though, your Word document must have a dropdown content control titled 'ID' - though you could use a different title (provided you use the same title in the document and in the code). Note also that the macro looks for a workbook named 'Workbook Name' (of all things) in your 'Documents' folder. You can change both the filename and folder.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Quote:
This is what i did: The files are in my documents folder and i've changed the location on the macro - created excel file (xlsx) and put in the first columm 10 names - created doc file and went to macros, create new and past the code above, changing the StrWkBkNm to match my file. - created a new dropdown and titled it "ID". But nothing happens, i've close the document and open again the dropdown "ID" is empty. Do you know what i'm doing wrong? I need it a lot. Thanks |
#6
|
||||
|
||||
Can you attach a document (including your modified copy of the macro) to a post (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
Quote:
I've attached my 2 files. Is it possible to make a macro that when i press F8 it will show the dropdown to select the names? thank you once again. |
#8
|
||||
|
||||
As the document you attached is in the docx format, it cannot contain a macro. Accordingly, it is not possible for me to see what you have done with the code.
Regardless, try the attached. I have adapted the code to your workbook, plus I've added the coded needed to output the value for the selected item to a second content control. Simply save the document to the same folder as your dados.xlsx workbook.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
Quote:
It appears a box but i can choose nothing. I've attached my macro. Thank you |
#10
|
||||
|
||||
Did you try selecting anything from the dropdown after opening the document? If it's empty, that suggests you either didn't enable the macro when prompted to do so or that you have macros disabled on your Word installation.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
Quote:
Here you have 2 prints with what is happening. Thanks |
#12
|
||||
|
||||
Well, unless you're dismissing the 'enable' option or you have an empty workbook in that folder, I cannot see how it is possible to end up with an empty list and no error messages.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#13
|
|||
|
|||
Ok, i try to edit your macro and it says that the macros in this project are disable, how can i enable please?
|
#14
|
|||
|
|||
Quote:
Please, is it possible to create an shortcut to put the 2 box after pressing it? Ex: Pressing F8, it will add the combox and the text area to match name+number joao n.º123456 Thank you |
#15
|
||||
|
||||
I have no idea what you mean. For example, pressing F8 has nothing to do with making a dropdown selection. If you want to make a dropdown selection, click on the dropdown. Nothing could be simpler and you certainly don't need a shortcut - unless you're trying to avoid using the mouse - but even then a shortcut won't make the selection for you.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Changing keyboard layout - Changing/removing keyboard shortcut | Hans L | Windows | 2 | 08-16-2015 05:33 PM |
keyboard shortcut | ilor | OneNote | 1 | 11-13-2014 02:48 PM |
disable ctrl+space excel keyboard shortcut | melvinjn | Excel | 2 | 11-27-2013 04:11 AM |
Keyboard shortcut for bookmarks | Jennifer Murphy | Word VBA | 1 | 01-06-2013 07:38 PM |
Outlook Keyboard shortcut | sostrow28 | Outlook | 1 | 12-10-2010 05:57 AM |