Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #61  
Old 07-03-2017, 05:20 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The basic code in in the zipped document attached to post #2. Open that document and press Alt-F11 to open the VBA Editor and access the code. Variations on the code have been discussed in numerous subsequent posts.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #62  
Old 08-17-2017, 11:08 PM
crosling crosling is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2013
Novice
 
Join Date: Aug 2017
Posts: 2
crosling is on a distinguished road
Default Getting the macro to work

Hi Macropod

I am having difficulty to get your macro to work in my document. (I have never used macros before)

I have been creating a word template.
I copied across - Client and client details.
I dont know how to copy and paste the macro across so it will work in my template.

Also, does my template have to be saved as a word enabled template for it to work?

Thank you
Reply With Quote
  #63  
Old 08-17-2017, 11:13 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Without seeing your template, its impossible to diagnose the issue. Can you attach it to a post (delete anything sensitive)? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.

And yes, for the template to be able to use a macro you'd have to save it as a macro-enabled template.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #64  
Old 08-17-2017, 11:21 PM
crosling crosling is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2013
Novice
 
Join Date: Aug 2017
Posts: 2
crosling is on a distinguished road
Default

Thanks for the quick response.

I dont think it is an issue but more i dont know how to copy a macro from your document into mine
Reply With Quote
  #65  
Old 08-17-2017, 11:54 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Open the template, then the VBE (Alt-F11) and select the template's 'This Document' code module. Copy the code from the relevant post, then paste it into the template's 'This Document' code module. Exit the VBE (Alt-F11) and save the template as a macro-enabled template.

Done.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #66  
Old 10-03-2017, 12:19 AM
kinimv kinimv is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Novice
 
Join Date: Oct 2017
Location: Seattle, WA
Posts: 9
kinimv is on a distinguished road
Default

Hi Paul, I am new to macros as well, and am looking for a solution to my problem without avail. I tried your zipped file, and understood how it work, but I need something more complex.

My document has a drop down list called 'Test Code.' Drop down options are 1,2,3...10
I want to make it such that whichever option is chosen, fields across the document are automatically filled in based on the option. For illustration, these fields are 'Test Objective', 'Test Conditions', etc. which are not successive fields, but are in different places. How do I implement this?

Thanks
Reply With Quote
  #67  
Old 10-03-2017, 01:24 AM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See post #33: https://www.msofficeforums.com/word-...html#post90264
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #68  
Old 10-08-2017, 06:52 PM
kinimv kinimv is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Novice
 
Join Date: Oct 2017
Location: Seattle, WA
Posts: 9
kinimv is on a distinguished road
Default

Hey Paul,
I looked back to #9 and #19, and didn't quite understand what you were trying to say. I tried messing around with the code based on what I thought was trying to be said, but failed to implement it without getting error codes every time. I have attached my template.

Best,
Vik
Attached Files
File Type: docx Test Report Template Upload.docx (36.7 KB, 37 views)
Reply With Quote
  #69  
Old 10-08-2017, 06:54 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Since a docx file can't contain any macros and neither your post nor your document says what you're trying to achieve, I'm not in a position to advise.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #70  
Old 10-08-2017, 07:49 PM
kinimv kinimv is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Novice
 
Join Date: Oct 2017
Location: Seattle, WA
Posts: 9
kinimv is on a distinguished road
Default

Sorry for the confusion. I messed up when removing the sensitive details and uploading. Here, I have attached it again.
What I'm trying to do is that when the Test Number is selected, I want the Description, Reason, and Objective to be filled in. I have filled these in to the values of the drop down list using '|', but I'm not able to have it print separately in different boxes.
Thanks
Attached Files
File Type: docm Test Report Template Upload.docm (43.7 KB, 53 views)
Reply With Quote
  #71  
Old 10-08-2017, 08:35 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

See attached.

Note: Unless you want spaces either side of your Description, Reason, and Objective outputs, you shouldn't have them in the TestNo control's values.

A generic version of the code is:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim i As Long, StrDetails As String
With ContentControl
  If .Title = "Client" Then
    For i = 1 To .DropdownListEntries.Count
      If .DropdownListEntries(i).Text = .Range.Text Then
        StrDetails = .DropdownListEntries(i).Value
        Exit For
      End If
    Next
    If StrDetails = "" Then StrDetails = "||"
    With ActiveDocument.SelectContentControlsByTitle("Output1")(1)
      .LockContents = False
      .Range.Text = Split(StrDetails, "|")(0)
      .LockContents = True
    End With
    With ActiveDocument.SelectContentControlsByTitle("Output2")(1)
      .LockContents = False
      .Range.Text = Split(StrDetails, "|")(1)
      .LockContents = True
    End With
    With ActiveDocument.SelectContentControlsByTitle("Output3")(1)
      .LockContents = False
      .Range.Text = Split(StrDetails, "|")(2)
      .LockContents = True
    End With
  End If
End With
Application.ScreenUpdating = True
End Sub
Attached Files
File Type: docm Test Report Template Upload.docm (50.5 KB, 324 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #72  
Old 10-08-2017, 09:36 PM
kinimv kinimv is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2016
Novice
 
Join Date: Oct 2017
Location: Seattle, WA
Posts: 9
kinimv is on a distinguished road
Default

Thanks a lot for your help!
The spaces on the sides were just a holdover from the description I had previously, thanks for pointing it out.
Reply With Quote
  #73  
Old 10-25-2017, 05:40 AM
strodden strodden is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2010 32bit
Novice
 
Join Date: Aug 2017
Posts: 22
strodden is on a distinguished road
Default Ongoing work in same document

I'm attaching the same document that I successfully got working earlier in this thread. When I recently added three names to my dropdown, the macro that updates names and phone numbers stopped working for my coworkers, but not for me! Not sure what's different on my machine vs. theirs. Thoughts?



Seth
Attached Files
File Type: docm Proposal Sheet Test.docm (105.5 KB, 134 views)
Reply With Quote
  #74  
Old 10-25-2017, 01:02 PM
macropod's Avatar
macropod macropod is offline Multiple entries in dropdown lists Windows 7 64bit Multiple entries in dropdown lists Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The ContentControlOnExit macro is missing from your document. If the updates are working correctly on your system without it, that suggests you've added the ContentControlOnExit macro to the document's template on your system instead of to the document itself.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #75  
Old 10-25-2017, 01:32 PM
strodden strodden is offline Multiple entries in dropdown lists Windows 10 Multiple entries in dropdown lists Office 2010 32bit
Novice
 
Join Date: Aug 2017
Posts: 22
strodden is on a distinguished road
Default

Yep - not sure how that happened but it's fixed and working now! Thank you!
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple entries in dropdown lists Delete Multiple Entries dudeabides Office 1 07-04-2011 02:49 AM
Multiple task lists and multiple calendars kballing Outlook 0 01-18-2011 10:23 AM
Creating Multiple Contact Lists meltee78 Outlook 1 01-03-2011 09:45 PM
multiple calendar entries across a group halfhearted Outlook 0 10-11-2009 12:13 PM
Word Forms : Dropdown lists wferaera45 Word 0 04-06-2006 03:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft