Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-03-2023, 05:25 AM
shaunfish shaunfish is offline Filling in legacy dropdown and using result to display information. Windows 10 Filling in legacy dropdown and using result to display information. Office 2021
Banned
Filling in legacy dropdown and using result to display information.
 
Join Date: Mar 2023
Posts: 1
shaunfish is on a distinguished road
Default Filling in legacy dropdown and using result to display information.

I have two word documents, one is a list of item definitions and the other is a form. I need to create a combo box on the form with a list of items, when an item is selected, I need for the definition to be displayed on the form.



Nothing seems to happen unless I click on the textbox and then I get an error saying that my text is too long. However the textbox is set to unlimited size

Here is a copy of my code

Option Explicit
Dim info As String

Sub sinor()
'
' test Macro
'
'
Documents.Open FileName:="C:\Users\Shaun\Desktop\lollz\descriptio ns.docx"
Selection.GoTo What:=wdGoToBookmark, Name:="SinoR"
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Copy
ActiveWindow.Close
info = Selection '.PasteAndFormat(wdFormatOriginalFormatting)
End Sub

Sub kamir()
Documents.Open FileName:="C:\Users\Shaun\Desktop\lollz\descriptio ns.docx"
Selection.GoTo What:=wdGoToBookmark, Name:="KamiR"
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Copy
ActiveWindow.Close
info = Selection '.PasteAndFormat(wdFormatOriginalFormatting)
End Sub

Sub fetch()
Dim myform As Document
Set myform = ActiveDocument
Dim bProtected As Boolean
'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If

Select Case ThisDocument.FormFields("code").Result

Case "Item 1"
sinor
ThisDocument.FormFields("Text1").Result = info
Case "Item 2"
kamir
ThisDocument.FormFields("Text1").Result = info

End Select

If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True, _
Password:=""
End If



End Sub


I have been busy on this for 3 days now and it has become urgent.

Any help would be greatly appreciated

Regards
Shaun
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling in legacy dropdown and using result to display information. How to keep the page position same after pressing tab Legacy dropdown box bil_san1 Word 3 10-14-2022 08:59 AM
Filling in legacy dropdown and using result to display information. How to Display Text on Multiple dropdown content control result philip.anthony Word VBA 11 03-28-2022 02:15 PM
Display Formula in Once Cell, Result in Another rspiet Excel 5 06-05-2018 08:27 AM
Filling in legacy dropdown and using result to display information. matching data from one work sheet to another, then auto filling missing cell information timomaha Excel 1 09-12-2014 07:51 AM
Filling in legacy field causes rest of line to move to next tab stop rtrdom Word 5 12-14-2013 05:48 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:45 PM.


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