aferia
asked on
Global Variables Reset when Dynamically Creating/Deleting or Changing OLEObjects
I have looked everywhere for a solution, but I sill cant find anything that explains the following problem:
Everytime I create/delete or change properties of an OLEObject in VBA it will reset all my variables.
I undetstand that VBA will reset variables on untrapped errors or when the code needs to me recompiled, but this does not seem to be the case for me since I am handling errors myself and I am not changing the code when the variables are lost.
Even a simple sniped like the following will reset my globals: "MyWorksheet" is the worksheet object, and "lblActualYearOrders" is an ActiveX label object created with the design tool from excell.
Please help.
Everytime I create/delete or change properties of an OLEObject in VBA it will reset all my variables.
I undetstand that VBA will reset variables on untrapped errors or when the code needs to me recompiled, but this does not seem to be the case for me since I am handling errors myself and I am not changing the code when the variables are lost.
Even a simple sniped like the following will reset my globals: "MyWorksheet" is the worksheet object, and "lblActualYearOrders" is an ActiveX label object created with the design tool from excell.
Please help.
MyWorksheetObject.lblActualYearOrders.Copy
MyWorksheetObject.Paste
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much!