#16
|
|||
|
|||
Quote:
Everyday i write documents talking about people and every time i talk about someone i need to put his name and number. So i'm trying to avoid writing the name and searching his number. The purpose of using a shortcut it's to simplify the work: everytime i need to mention someone i will press F8 adding the Dropdown and choosing the correct name. Ex: The joao n.º123456 it working good for now. the paulo n.º324543 is missing the sessions. the jorge n.º235631 is wroking harder to complish the session. Hope i've clarified you |
#17
|
||||
|
||||
But that is not the function of the F8 key, which is to extend a selection. See: https://support.office.com/en-us/art...-f762f663ceb2?
I should also point out that, as coded, the dropdown will only let you choose one entry per document and that, every time you open the document, the dropdown list will be reset. To prevent that, you would need to save the document as a template and make some coding changes. The advantage is that the macro now only needs to exist in the template - the documents it creates can all be saved in the docx format. See attached.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#18
|
|||
|
|||
Quote:
What i mean is, can i record a macro to use any keyboard shortcut to add the dropdown to choose the name? I mean, i will need lots of dropdown since i write minimium of 10 persons by document. Maybe it's not possible |
#19
|
||||
|
||||
Sorry, but that just isn't how these things work. What you'd need for the scenario you envisage is a macro that not only calls the data from Excel but also creates both the dropdown it's going to populate and the one the data gets output to. Sure, it's possible, but that's a lot of coding effort just to spare you writing a few details. If these are names & details you re-use frequently in the same document or otherwise on a regular basis, you'd do better to create a custom quick part for each one and recall each as & when you need them. See: https://support.office.com/en-gb/art...-41c771847a7b?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#20
|
|||
|
|||
Quote:
I will try it out |
#21
|
|||
|
|||
If i record a macro with a keyboard shortcut and that macro will create a new dropdown with "ID". It works, but only show records if i save, close the document and then open the document.
Is there anyway to refresh the dropdown data after the same have been created? If so, it will solve my problem Thanks |
#22
|
||||
|
||||
At the end of your recorded macro, add the line:
Call Document_Open
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#23
|
|||
|
|||
Quote:
I've attached my macro. Thank you |
#24
|
||||
|
||||
Try the attached template. When you create a new document from it, two content controls are created and the first, a dropdown, is populated from the Excel workbook. To add more content control pairs (after making a selection from the first content control, thereby deleting the first pair), all you need do is run the AddControls macro.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#25
|
|||
|
|||
Quote:
the first time i open the document i can choose the a name and it will put the number(perfect), but after pressing F8(the shortcut i made for insert the new dropdown), it insert the dropdown but without names and then gives me the error attached One again thank you for trying to help me |
#26
|
||||
|
||||
Without being able to see both the document behind the message box or the code line generating the error, I cannot advise further - the code works fine for me.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#27
|
|||
|
|||
Quote:
Here you have it |
#28
|
||||
|
||||
It appears you deleted the second new content control created by the 'AddControls' sub before selecting the dropdown.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#29
|
|||
|
|||
Thanks,
When i press F8 my macro creates only the dropdown, how can i make to create the second control? |
#30
|
|||
|
|||
Your macro works amazing well
But how can i define F8 to run your macro? EDIT: I done it. I've record a macro to run your macro. Thank you man, it's amazing perfect |
|
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 |