Hi there, I've come across a most frustrating issue recently (using Excel 2007) regarding named ActiveX controls that reside on a Worksheet. Everything compiles and runs perfectly on my PC (Windows 7 32-bit/Office 2007) The file(s) in question are .XLS files, and when opened on another PC (Windows 7/Office 2007) as soon as the macros are enabled, it immediately opens the VBA code window up with one of my control names highlighted (e.g. "txtLName1") and shows the error message "Compile error - Variable Not Defined."
I have hunted and hunted for potential solutions, but none that I found worked for me...does ~anybody~ here have any idea how I can fix this? Any help whatsoever would be greatly appreciated!!
Procedure Code:
Public Sub InitBackDoorControls()
txtLName1.Visible = True ' Where highlight appears in context of error message
txtLName1.Text = ""
txtFName1.Visible = True
txtFName1.Text = ""
cbxPlan.Visible = True
Call ShowPlanList
chkFrzOnly.Visible = True
chkFrzOnly.Value = False
cbxFullOrSplit.Visible = True
Call ShowFullOrSplitList
lblPart.Caption = 1
cbxNumDeliveries.Visible = True
Call ShowNumDeliveriesList
cbxHasCP.Visible = True
Call ShowHasCPList
txtLName1.Activate
Range("COST_RATE") = ""
COST_RATE = DEFAULT_COST_RATE
cmdLoadFromFile.Visible = False
End Sub
The issue appears to be the fact that somehow, on a PC other than the one I am working on (where everything works just fine), the names of the ActiveX controls which reside on the Worksheet are being reset to default names i.e. "CommandButton1", "TextBox1" etc...and in that light, the code referencing the control by it's assigned name will trigger the error "Variable not defined." The "Option Explicit" statement seems to make no difference whatsoever.
I have tried deleting *.exd files from %Temp% directories on client PCs...as suggested by Microsoft, and still to no avail!!!
If you need more info from me, please advise...
Bookmarks