View Single Post
 
Old 10-14-2011, 03:21 AM
SaneMan SaneMan is offline Windows 98/ME Office 2003
Novice
 
Join Date: Jan 2011
Posts: 20
SaneMan is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi SaneMan,

If you run the following code, you'll see which variables do/don't exist. It's a bit hard to populate those that don't ...
Code:
Sub Test()
Dim i
With ActiveDocument
  For i = 1 To .Variables.Count
    MsgBox .Variables(i).Name & vbCr & .Variables(i).Value
  Next
End With
End Sub
Hi macropod

Thanks for that. I tested the Macro on the userform and all the variables that I have entered appear to be populating.

If I put a letter into the actual document behind the userform then the variables populate fine. The problem appears to occur when the form opens the letter up from another location. It opens it up fine but there doesn't seem to be a link between the userform and the new document that would communicate with it and input the variables into the DocVariable references in the letter.

I feel like there must be an obvious and simple way of fixing this but I've ran out of ideas. I assume there must be some code you can put into the macros in the user form so that when the form opens up the new letter it has a direct link to it and refreshes the variables in the letter with the variables that have already been populated on the form.

Thanks for your help on this.
Reply With Quote