View Single Post
 
Old 02-10-2022, 05:11 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Are you expecting to have both userforms open at the same time? If so, you will need to make them modal.

If the userform reads document variables in order to populate the relevant userform on initialisation then you can simply read the document variables from one file and write them to the other file. For example
Code:
Private Sub VariableTransmission()
  Dim doc1 As Document, doc2 As Document, aVar As Word.Variable
  
  Set doc1 = ActiveDocument
  Set doc2 = Documents.Add
  
  doc1.Variables.Add "First", "Hi mum"
  doc1.Variables.Add "Second", "Hello world"
  
  For Each aVar In doc1.Variables
    doc2.Variables.Add Name:=aVar.Name, Value:=aVar.Value
  Next aVar

  Debug.Print doc2.Variables("Second").Value
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote