A
Al@n
Hi
I'm trying to import an excel cell value into a textbox on a word userform.
I've managed(with the help of code found in the forums to open a document
based on a word template and get the word userform to display but
cannot get the cell value to populate the textbox on the word userform.
Example code below(Office 2003)
________________________
Private Sub cmdQuote_Click()
Dim WD As Object
Dim MyDoc As Object
Set WD = CreateObject("Word.Application")
With WD
Set MyDoc = .Documents.Add(Template:= _
"C:\Documents and Settings\Owner\Desktop\Gas Quotation.dot", _
NewTemplate:=False, DocumentType:=0)
MyDoc.Activate
MyDoc.UserForm("txtAdd1").Result = ActiveSheet.Range("C8").Value
'**********
..Visible = True
End With
End Sub
__________________
TIA
I'm trying to import an excel cell value into a textbox on a word userform.
I've managed(with the help of code found in the forums to open a document
based on a word template and get the word userform to display but
cannot get the cell value to populate the textbox on the word userform.
Example code below(Office 2003)
________________________
Private Sub cmdQuote_Click()
Dim WD As Object
Dim MyDoc As Object
Set WD = CreateObject("Word.Application")
With WD
Set MyDoc = .Documents.Add(Template:= _
"C:\Documents and Settings\Owner\Desktop\Gas Quotation.dot", _
NewTemplate:=False, DocumentType:=0)
MyDoc.Activate
MyDoc.UserForm("txtAdd1").Result = ActiveSheet.Range("C8").Value
'**********
..Visible = True
End With
End Sub
__________________
TIA