Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 11-18-2015, 12:28 PM
shg shg is offline Declaring a variable that is known across modules Windows 7 64bit Declaring a variable that is known across modules Office 2010 32bit
Advanced Beginner
 
Join Date: Oct 2015
Posts: 55
shg is on a distinguished road
Default

The reason for declaring them is a separate module is just hygiene. They are not specific to any other module (that's why they're public), and keeping them together lets you find them all at a glance. For someone trying to understand your code, it's a good place to start reading.

Public variables have their place, but should be used only after careful consideration of the alternatives. In general, they can make code harder to debug and maintain.

The only code I might include in that module is a routine that initializes those variables.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Time Error '91': Object variable or With block variable not set using Catalogue Mailmerge Berryblue Mail Merge 1 11-13-2014 05:36 PM
Declaring a variable that is known across modules Modelling training modules Vincent Project 3 09-03-2014 05:37 PM
Declaring a variable that is known across modules Run-time error 91 object variable or with block variable not set JUST ME Word VBA 4 03-25-2014 06:56 AM
Declaring a variable that is known across modules Empty Modules Greg S. Excel Programming 2 07-30-2013 01:38 PM
Declaring a variable that is known across modules Run-time error '91': Object variable or With block variable not set tinfanide Excel Programming 2 06-10-2012 10:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft