Compilation problems

dogdays

Active Member
Joined
Apr 28, 2008
Messages
434
Office Version
  1. 2007
With no warning of exceeding limits
I ended up with a variable undefined.
the entry is a global string.
I tried moving the variable about
but I do not the order of compilation.

tia Jack
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Not clear what you're saying - especially the last sentence. You're raising an error message when you try to compile code? Or you're raising an error when you use the db? Something else?
If #1 then could be that
a) a reference to the variable is mis-spelled
b) the variable does not have the proper scope
c) you have Option Explicit at the top of a module but did not declare a variable that you are trying to use in code
 
Upvote 0
With no warning of exceeding limits
I ended up with a variable undefined.
the entry is a global string.
I tried moving the variable about
but I do not the order of compilation.

tia Jack
the line but I do not know the order of compilation. (could be a scope problem) the variable is
Global Const gcstrExcelExportFieldsTableName As String = "tblExcelExportFields"
the variable in question is global

thx for the reply
Jack
 
Upvote 0
That looks like a constant being declared, not a variable.
If declared in a procedure, regardless of where its scope is that procedure only. IIRC, you'd raise an error trying to make it public inside of a procedure.
If declared at the top of a form/report module its scope is to any procedure in that form/report only.
If declared Public at the top of a standard module its scope is project wide.

Without seeing your code project I don't know what else to suggest, except maybe to research scope of variables & constants
 
Upvote 0
The problem is at compile time
I changed every instance of global to Public, no joy.
Still get Variable not defined.
What does IIRC stand for?

Jack
 
Upvote 0

Forum statistics

Threads
1,221,513
Messages
6,160,242
Members
451,632
Latest member
purpleflower26

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