Compilation error question

  • Thread starter Thread starter Nathan Gutman
  • Start date Start date
N

Nathan Gutman

I have designed a workbook which contains quite a bit a vba code.
It runs flawlessly on my computer but a user reports that he gets a
compilation error which he can not see because that VBA project is
password protected.
I can not reproduce this problem because everything run Ok here.
How do I pin down this error?
Thanks,
 
Nathan,

There is little if anything you can do to diagnose the problem if
you can't open the VBProject on the machine that is causing the
problem. Are you and the user running the same version of Excel?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Nathan;

You could edit the code to take advantage of the ERR
reserve word. The ERR method always provides return codes
that are reported.

Go into VBA help and go into the help. Search for ERR and
it will give you examples on how to do it.

Thanks,

Greg
 
Nathan

I'll bet dollars to donuts that it's a missing reference on the other
machine. I can't think of what else would cause a compile error. What
references do you have set for your code that the other machine wouldn't?
Maybe you could use late binding on those to avoid the problem.
 
I tend to agree with that. I use a reference to Solver.xla which the
ohter machine may not have.
Wouldn't the reference come to the other machine with my VBA project
but if the Solve add-in was not installed on the other machine than
this could create that error?
And can you elaborate a bit on "late binding"?
Thanks,
 
Thought the original poster said the user got a compilation error which
means the code doesn't run. Wouldn't your suggestion require that the code
runs?
 
Late binding would apply to references to COM objects. An XLA isn't a COM
object, so I don't think it is applicable to this situation if that is the
problem. I believe you would need to remove the reference to solver and
create it programmtically if you successfully test for the availability of
solver.xla.
 
Problem solved. I was able to reproduce that error by renaming
Solve.xla so it wouldn't be available. The user did not have the
Solver add-in available. Once he fixed it everything ran OK.
Oh well, till next time.
Thank you all for your help.
 
Back
Top