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

"Jamie Collins" skrev i melding
oups.com...
As far as I know there is no good reason for using a Public variable;
I've never used one myself. If you need to share a module-level
variable with another module, you can use a Property


Hi Jamie

Question of style, I think. I use public variables for things that are used
all over the app and that won't change "today" (=during the session).
Typically it's a username, a database address, environmental information, a
major choice in startup, ...

Best wishes Harald


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Dim vs. Public


Harald Staff wrote:
I use public variables for things that are used
all over the app and that won't change "today" (=during the session).
Typically it's a username, a database address, environmental

information, a
major choice in startup, ...


I can see a justification in these cases because they are genuinely
global to the project/session in question. Such measured thought is not
always present. I was recently tempted in an Excel project to use a
Public variable named IsDirty but when I stopped to think about it, I
concluded it was specifically the *workbook* I was flagging as dirty,
therefore I ended up creating a Friend Property in the ThisWorkbook
code module.

Question of style, I think.


At the level being discussed here, definitely. To use all Public
variables declared as Variant may be a 'dubious' style <g.
Jamie.

--

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 Variables Jerry McNabb Excel Discussion (Misc queries) 0 February 24th 08 01:26 AM
Public Password Excel 2003 - SPB Excel Discussion (Misc queries) 2 May 23rd 07 11:08 PM
Public Function Monty Excel Discussion (Misc queries) 9 December 24th 04 06:35 PM
public sub Bob Excel Programming 3 December 10th 04 08:49 PM
Public Sub Help No Name Excel Programming 2 May 18th 04 11:09 PM


All times are GMT +1. The time now is 04:33 PM.

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

About Us

"It's about Microsoft Excel"