View Single Post
  #25   Report Post  
Posted to microsoft.public.excel.programming
Dave Birley Dave Birley is offline
external usenet poster
 
Posts: 171
Default Practical Macro Size Limit?

Awesome stuff, Carl. Just what I was looking for. I made my initial move into
geekdom around age 50, so I have deliberately avoided getting too catholic in
my selection of languages to master. For most of 25 years or so I worked in
the xBase/VFP genre. The result is that I have a very solid grounding in
programming principles, many of which are universal, but picking up the
vocabulary and syntax is about as complex as when I was learning Swahili (in
1957). The brain says "House boy, bring food", but the mouth needs to say
"Mvulana, lete chakula!".

I have appreciated the way that folks here are so supportive, and
non-judgemental.
--
Dave
Temping with Staffmark
in Rock Hill, SC


"Carl Hartness" wrote:

Hi Dave,

New guy on the thread. I can't see where anyone answered this. To
rename a module in VBE, press F4 (short for View - Properties). Put
your new name after (name) in place of Module1.

I find my procedures to be a little longer than they used to be. Even
with really descriptive sub names and good comments, continually
jumping between procedures made it tough to follow the flow. So I
have gravitated toward subs where the code is repeated in several
places so the code can be re-used. Examples of topics that repeat in
just about every application are changing folders, setting paths,
opening and saving files. Grouping these in a module makes it easier
to pull them into the next project and re-use the code.

One of the trade-offs to passing lots of parameters is to define
Public variables (for variable scope discussion, see Declaring
Variables in VBE Help) which can be seen from any module, or putting
Dim at the top of a module where it can be seen from any macro in the
module. Be sure to use Public and module level variable names that
you aren't going to use in a lower scope. It can be tough to debug a
problem with Public x% when you have Dim'd x% in a smaller scope.

I, too, like to keep my screen display more compact to reduce
scrolling. I tend to have three levels of comments:
' **************
' really major blocks of code
' **************

' comment applies to the next few lines

code code code code code code ' one word or phrase
Same line comments don't work if the line of code is long so that you
have to horizontal scroll to see the comment. Back in the days of
line editors, before vi and emacs, when I cound print my code on 132
column chain printers, all my comments were same line comments,
typically starting at column 81!

Also on the screen display topic, I tend to continue long code to the
next line with " _" to reduce horizontal scrolling. This especially
helps when nesting IF's and WITH's have pushed even short lines out of
sight. Literal strings can only be continued to the next line by
splitting the string, such as "Ab Cd" to "Ab" & " Cd"

These are some practices I have found handy for myself even though
they might not be "standard" coding practices.

Carl

On May 29, 12:07 pm, Dave Birley
wrote:
«then i might name the module»
I just Inserted a new Module, but I can't seem to find where I name it. Also
it Started out with "(Declarations)" As the only choice in the right drop
down,a nd "(General)" for the left (also only one). Am I supposed to be
allowed to tweak these?
--
Dave
Temping with Staffmark
in Rock Hill, SC