Solved

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

Posted on 2013-11-13
2
836 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
2 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Boolean help 6 27
Vlookup nonexact IP address match 32 51
Copy value from a certain cell 5 24
Mac Excel column treating text as date 2 31
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now