?
Solved

Does Excel VBA support the ActiveX label control in Word 2010 documents ?

Posted on 2013-11-13
2
Medium Priority
?
948 Views
Last Modified: 2013-11-13
Hi,

This is a similar problem I've had before but in a different scenario.

I have an Excel 2010 macro which, on a click of a button:
   1. Opens a Word 2010 document
   2. Takes values from the Excel sheet and populates ActiveX label control placeholders in the Word document.

I'm getting an 'Error 438 Object doesn't support this method or property' when it tries to populate the first label on the Word document.

I have selected the 'Microsoft Excel 14.0 Object Library' entry in Tools --> References and have attached the Excel workbook (TD9.xlsm) and the Word document (ET9.docx).

My questions are:
Why do I get an Error 438 on a Word label control ?
Does it matter if the Word document is either a .docx or a .docm (given it only contains controls and no actual code) ?

Thanks for your help
TD9.xlsm
ET9.docx
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 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 2000 total points
ID: 39644105
The labels are not members of the Application object - they belong to the document:
Private Sub cbEnquiryLetter_Click()

   Dim WordApp As Object
   Dim WordDoc As Object
   Set WordApp = CreateObject("Word.Application")
   Set WordDoc = WordApp.Documents.Open("C:\Users\Toco\Desktop\ET9.docx")
   WordApp.Visible = True
   
   With WordDoc
      .laClient.Caption = "Enquiry from " & Sheets("Training").Cells(4, 9)
      .lacourseType.Caption = "Re. One-to-One Training - " & Sheets("Training").Cells(4, 8)
      .laTodaysDate.Caption = Format(Now, "dd mmmm yyyy")
      .laContactTitle.Caption = "Dear " & Sheets("Training").Cells(4, 10) & ","
   End With

End Sub

Open in new window

0
 

Author Closing Comment

by:Tocogroup
ID: 39644258
Many thanks Rorya. That works fine
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

765 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