Import Data from a form to a word package
I am trying to import an address from a customer details form to an invoice in word, but it seems to not work. I have below shown two different types of codes that I have tried to use, but they both do not seem to work.
Can you please help!
Dim frmCustomerDetails As Form
Set frmCustomerDetails = Screen.ActiveForm
Dim txtContact As Control
Set txtContact = Forms!frmCustomerDetails![CustomerID]
txtContact.Value = [Address1]
TextToWrite = " " & frmCustomerDetails.Table![Address1]
TextToWrite = TextToWrite
If Replace(TextToWrite, " ", "") <> "" Then oApp.Selection.TypeText Text:=TextToWrite & ""