Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I populate a Word 2010 HTMLText box from Excel ?

Posted on 2013-11-25
5
Medium Priority
?
441 Views
Last Modified: 2013-11-25
Hi,

I've been sent a Word document with a number of input form fields. However, they don't appear to be legacy or ActiveX label or text box controls as when I check their properties they have far few attributes, for example...

Name DefaultOcxName9 (HTML TextArea)
Columns 39
Height 102.75
HTMLName ctl00$ContentMain$RoomContactForm$TbAddress
Rows 8
Value
Width 170.25
WordWrap OFF

What sort of controls are these ? And how do I refer to them in Excel VBA if I want to populate them from a worksheet.

Thanks
Toco
0
Comment
Question by:Tocogroup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 39674612
Can you post the document (or a relevant bit of it), so we can see exactly what it is, please?
0
 

Author Comment

by:Tocogroup
ID: 39674846
0
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 1000 total points
ID: 39674907
Hi,

pls try this way

Sub test()
Dim WD As Object
Set WD = CreateObject("Word.Application")
WD.Visible = True
WD.Documents.Open "D:\test.doc"
WD.ActiveDocument.DefaultOcxName10.Value = Range("A1")  '"myName"
WD.ActiveDocument.DefaultOcxName9.Value = Range("A2")  '"myAddress"

WD.Documents("D:\test.doc").Close SaveChanges:=True
WD.Quit
Set WD = Nothing

End Sub

Open in new window

Regards
0
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 1000 total points
ID: 39674911
Thanks. They are ActiveX controls than can be addressed directly by name, e.g.
doc.DefaultOcxName9.value = "abc" & vbcr & "def"
where doc is a Word document object
0
 

Author Closing Comment

by:Tocogroup
ID: 39674960
Thanks for your combined efforts - code and explanation.

It works fine. Much appreciated.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question