Link to home
Start Free TrialLog in
Avatar of jana
janaFlag for United States of America

asked on

Why would the same Excel VBA work different in different computers

Same excel works different in different PC.  Both PC are same specs.

Message "variable not declared"
Avatar of jana
jana
Flag of United States of America image

ASKER

Update


We have an apps that export to excel data.  When exporting, it also creates a module by importing a .BAS.

In one computer works excellent.  In another, it doesn't.  The error is that the variables are not.

But why one PC works the other no.  Both PC are windows 7 and both have office 2007.

Reviewing the problem we thought that it may be that one excel setups the exported excel with "option explicit" while the other doesn't.

This is the closet guess.

What can be causing this problem?
Avatar of Saqib Husain
That is just the problem. Either delete the Option explicit or declare the variables.
Check reference are the same for 2 computers...
Developer->Visual Basic: Tools->references
Hello, set option explicit up in both computers. In the VBE click tools > options > always declare variables.

Cheers, teylyn
ASKER CERTIFIED SOLUTION
Avatar of VipulKadia
VipulKadia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jana

ASKER

Of course, thank you very much!!!  we go about it as as we get to the office!!
Avatar of jana

ASKER

Yes it worked!! The excel was created and filled upt certain point.  The following errors:

          Runtime error 1004
          using advance filter, select range

          Runtime error 1004
          Cannot asigne propertis PriuntQuality class PageSetup

We have compared both PC Excel 2007 option and found some differences and made them alike.

But still problem.

Can you shed some light on this?
FilterError.jpg
PageError.jpg
Avatar of jana

ASKER

We are tedious comparing excel option and it's VBA options the good and the bad PC to make sure both are same.

Anything else we should consider based on the error messages?
Hi Ramante,
As you got the answer for your original question, I request you to close this question and as you have another question, please ask it as a separate question.

Avatar of jana

ASKER

Prior placing these last two errors of error 1004, we tediously compared the PC Excel Option that display the correct Excel VBA and the PC that doesn't display correctly the Excel VBA.  There were like 3 more that appear after the initial "variable not declared".  These 3 we fixed it and since these last 2 of error 1004 couldn't, we posted to the thread.

Nevertheless, if you want to place another question we'll do.  But what happens if after the error 1004, another appears?

We are checking differences in PC configuration besides the Excel Option or maybe there is another place that relates to the Excel that we should look at?

Please advice
Ramante,
If you face any other error then post it as an another thread(Question).
Avatar of jana

ASKER

Ok will proceed when at office.
Avatar of jana

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for Ramante's comment http:/Q_27396195.html#36968334

for the following reason:

Thanx
Ramante,
I request you to accept the solution, as you already got the solution for your original question. Now, after getting solution to your original question, if another error has occured then you should ask another question.
Avatar of jana

ASKER

Sorry about that, I chose the wrong entry for the answer; will close correctly.
Avatar of jana

ASKER

Sorry, chose incorrectly.