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

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
TocogroupAsked:
Who is Participating?
 
GrahamSkanRetiredCommented:
teCourseType is an ActiveX text box control. It does not have a Caption property. Try '.Text' instead.
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Your supplied xl file is xl-test whereas your script calls for xl test ... i.e. file name with and without hyphen

Chris
0
 
TocogroupAuthor Commented:
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
 
TocogroupAuthor Commented:
Thank you. That was exactly the problem.
Much appreciated
Toco
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.