Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Public Variable

Is it possible to set a value for a public variable in one workbook, and then
use its value in another workbook? Of course, the first workbook would
remain open.

What I am trying to do is set an "authorization" value for a user when EXCEL
starts, and then use that value to allow or disallow use of functions in my
own addin.

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Public Variable

How about adding a function in the workbook with the public variable. That
function's only job would be to return the value of the public variable.

Option Explicit
Dim YourPublicVariableNameHere As Variant
Sub aa()
'initialize it someway
YourPublicVariableNameHere = "testme"
End Sub
Public Function GetVal() As Variant
GetVal = YourPublicVariableNameHere
End Function

and in the other workbook:

Option Explicit
Sub auto_open()
Dim myVar As Variant
myVar = Application.Run("'book1.xls'!getval")
MsgBox myVar
End Sub


Marvin wrote:

Is it possible to set a value for a public variable in one workbook, and then
use its value in another workbook? Of course, the first workbook would
remain open.

What I am trying to do is set an "authorization" value for a user when EXCEL
starts, and then use that value to allow or disallow use of functions in my
own addin.

Thanks.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Public variable Eric[_35_] Excel Programming 7 March 18th 07 06:54 AM
Public variable Jack New Users to Excel 4 March 18th 06 09:35 PM
Public Variable Jason Excel Programming 4 April 12th 04 07:06 PM
Use Checkbox Value or Public Variable? Stratuser Excel Programming 2 February 12th 04 02:33 PM
public variable marwan hefnawy Excel Programming 1 September 5th 03 08:54 AM


All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"