Solved

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

Posted on 2013-11-12
4
730 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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