Macro code error message.

ginny777

New Member
Joined
Apr 1, 2011
Messages
26
Hi I have a macro that I have been using, (written with help from Mr. Excel).

I have used it on the first computer, copied it to a second and used it, and now I am trying to use it on a new (older) computer. When I try to run it on this last computer I get the error message: "Compile error: user-defined type not defined" Can anyone help with why this is happening only on this one computer? Thanks for any suggestions.

Here is the beginning of the code with the line in question in red.:

Sub XL_to_text()
Dim i As Long, j As Long, k As Long, l As Long, lastrow As Long
Dim oFS As FileSystemObject
Dim oTS As TextStream
Dim FilesName As String
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Are you using the same versions of Windows and Office on all three PCs?

I suspect it is a missing reference...
Check Tools/References on a PC where the macro works and compare that with the PC where the macro doesn't work... you should be able to find the missing reference that way... add it and you should be fine...
 
Upvote 0
Thank you for your response.

The first computer had '07, the second and third have '03

I can't find "Tools/References" anywhere, nor do I find reference to that in any of my VBA books. Can you tell me where to locate that?

Thanks.:confused:
 
Upvote 0
Never mind question above, I was looking for it in excel, not the VB editor.

I am not where I can access the offending computer right now, I'll let you know if it worked as soon as I can.

Thanks again.
 
Upvote 0
sorry, I assumed everyone knows where to find Tools/References :biggrin:
Next time I will mention VB editor alongside...
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,767
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top