Solved

What is a VBA error 438 and how do I resolve it ?

Posted on 2013-11-12
4
735 Views
Last Modified: 2013-11-12
Hi,

I have a very simple macro which, on a click of a button, takes text values from an Excel sheet and populates placeholders in a Word document. However, I'm getting an 'Error 438 Object doesn't support this method or property'.

I've selected the 'Microsoft Excel 14.0 Object Library' entry in Tools --> References if that has anything to do with it.

I've attached the Excel workbook and (as EE doesn't allow the upload of .docm files) a docx file with the macro code pasted beneath the placeholder code.

Thanks
XL-Test.xlsm
Microsoft-References.jpg
Excel-to-Word-Test-1--docx-.docx
0
Comment
Question by:Tocogroup
  • 2
4 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 39640947
Your supplied xl file is xl-test whereas your script calls for xl test ... i.e. file name with and without hyphen

Chris
0
 

Author Comment

by:Tocogroup
ID: 39640959
Hi Chris,

The XL file I uploaded was 'XL Test.xlsm'. So I can only assume EE replaces spaces in filenames with a hyphen. It did the same with the Word document I uploaded.

Anyway, having changed my script to point at XL-Test.xlsm the macro still falls over at the following line:

   ThisDocument.teCourseType.Caption = exWb.Sheets("Training").Cells(3, 5)

Toco
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 39641023
teCourseType is an ActiveX text box control. It does not have a Caption property. Try '.Text' instead.
0
 

Author Closing Comment

by:Tocogroup
ID: 39641091
Thank you. That was exactly the problem.
Much appreciated
Toco
0

Featured Post

Technology Partners: 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

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
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 use longer labels with horizontal bar charts instead of the vertical column chart.

679 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