I have a form with a listbox. I want to open a new blank form and assign the same values to the blank form's listbox. What is the best way to go about doing this? I have a majority of the code configured. My problem is writing the proper syntax to assign the listbox in the new blank unsaved document "doc" the values from the first document's listbox.
Should I declare a temporary listbox to carry over the values to the next listbox?
My listbox is named IRABene_Main.Li stBox1 in both documents and I can't seem to find a way to write doc.IRABene_Mai n.ListBox1and mean to update the blank form's listbox.
See the following code:
Should I declare a temporary listbox to carry over the values to the next listbox?
My listbox is named IRABene_Main.Li stBox1 in both documents and I can't seem to find a way to write doc.IRABene_Mai n.ListBox1and mean to update the blank form's listbox.
See the following code:
Code:
Private Sub UpdateAdditionalAccount_Click() Dim appWord As Word.Application Dim doc As Word.Document Dim Name As String Dim SSN As String Dim bday As String Dim address As String Dim dayphone As String Dim branch As String Name = Me.FormFields("name1").Result SSN = Me.FormFields("ssn").Result bday = Me.FormFields("bday").Result address = Me.FormFields("address").Result dayphone = Me.FormFields("dayphone").Result branch = Me.FormFields("branch").Result Set appWord = CreateObject("Word.Application") appWord.Visible = True Set doc = appWord.Documents.Add(Template:="S......Y.docm", NewTemplate:=False, DocumentType:=0) doc.FormFields("name1").Result = Name doc.FormFields("ssn").Result = SSN doc.FormFields("bday").Result = bday doc.FormFields("address").Result = address doc.FormFields("dayphone").Result = dayphone doc.FormFields("branch").Result = branch End Sub
Comment