View Full Version : Solved: User Defined type

12-10-2004, 01:11 AM
Not sure why this keeps happening, I am trying to use DRJ's code for combining files in a folder, the example file available with the code works but if I cut and paste the code and use it in a different wb, it keeps debugging on the:

Dim Wkb As Workbook line

This happens all the time when I try to declare a variable as a workbook

Why would the example file (Read-Only) run the code with no problems accurately, but then not run in any other files? Why can't I set a Workbook variable in any files I have. I read through the help files and I can;t find a reason or duplicate code or even duplicate workbook name or anything that it said to look for that may cause this. Whats the deal?

Jacob Hilderbrand
12-10-2004, 01:23 AM
Can you post an attachment with a new workbook where you have this code added and it does not work?

12-10-2004, 01:41 AM
This one I created and pasted your code into: Debugs on the afor mentioned Line, Next post the file I downloaded from here, and it is a copy of that read-only file: This one works and both files are right next to each other, with what I can see, no difference. Thanks DRJ

12-10-2004, 01:42 AM
File from here:

Jacob Hilderbrand
12-10-2004, 02:05 AM
The VBA Project in your file is called "Workbook". This is causing a conflict. Change the project name and it should work fine.

12-10-2004, 02:10 AM
Anybody ever mention that you Kick A**?

Jacob Hilderbrand
12-10-2004, 02:16 AM
Why thank you :)

Take Care

Zack Barresse
12-10-2004, 02:21 AM
Yeah! Jake kicks A**!!! :)