Application variable not Accesssible inside function?

Add-in Express™ Support Service
That's what is more important than anything else

Application variable not Accesssible inside function?
 
Davide Crudo




Posts: 23
Joined: 2005-05-09
In an Excel Plug-in I'm trying to access an Application Variable inside the function, previously set in the application itself.

The variable name is 'Password' and implemented it as following:

uses
SysUtils, ComObj, ComServ, ActiveX, Variants, adxAddIn, AcerRetrieve_TLB, Dialogs,
Classes, DB, DBAccess, MyAccess, MemDS, StdVcl;

type
TA_Retrieve = class(TadxAddin, IA_Retrieve)
protected
function dbGet(var dbtable, ResultColumn, dbwhere,
dbfunction: OleVariant): OleVariant; safecall;



end;

TAddInModule = class(TadxCOMAddInModule)
DBConn: TMyConnection;
MyQuery1: TMyQuery;
adxCB: TadxCommandBar;
procedure adxCBControls2Change(Sender: TObject);
procedure DBConnError(Sender: TObject; E: EDAError; var Fail: Boolean);
procedure adxCBControls3Click(Sender: TObject);

private
protected
var Password : String;
public


end;

implementation

uses Unit1;
[...]


// In My code I assign the password as following:

procedure TAddInModule.PasswordSet(Sender: TObject);
begin

Password := adxCB.Controls[2].AsEdit.Text;

end;

Inside the function If I try to view the content of the password:

showmessage(TAddInModule(Self.COMAddInModule).Password);

The result is empty.

Any way to access already pre-set variables in the application?

Thank you in advance!
Davide

Posted 20 Jun, 2005 05:52:20 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Davide,

The point is in this case Excel creates and loads two add-in instances (one as a COM Add-in and one as a custom function add-in). So it is not possible to exchange data between them in the way you indicated.

Posted 20 Jun, 2005 07:10:51 Top