'Declare a Public Variant as constant
I am having trouble assigning a value to constant variant declaration. So the declaration is this
Option Explicit
public const Abc as variant = ?
Abc is a Microfocus rumba object which gets initiated when the workbook is open, something like this
sub workbook_open()
Set Abc= session.GetRDEObject()
End sub
But I cannot use this to assign it to the const variable, it says "Circular dependencies". The reason I am wanting to assign value is to ensure the object Abc is alive even after user executes End statement. Is there a way I can do this?.
I have tried creating a separate function and adding its return value to the Abc, but it does not work.
Solution 1:[1]
A constant is exactly that, so try something like this:
Option Explicit
Private Abc As Object
Private Sub Workbook_Open()
Set Abc = Session.GetRDEObject()
End sub
Public Function GetAbc() As Object
Set GetAbc = Abc
End Function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Gustav |
