J.E. McGimpsey:
Thank you for your reply on this thread:
The Personal Macro Workbook is just like any other workbook. PMW is
just the name that Excel gives by default when it creates a workbook
for your macro. You could create a workbook named "fred" and it
would work the same, as long as it was put in the Startup Folder (by
default, the PMW is hidden - you can unhide it, or hide "fred",
using Window/(Un)Hide...).
I think you are saying that opening a workbook containing any macros makes
all those macros available for the balance of the session. Makes sense.
In WinXL, the file is named Personal.xls (a throwback to earlier
Windows' 8.2 limitation) and it's stored in a folder named XLStart
in the Office directory (the actual path depends on the version, I
believe).
I searched on permutations of "personal" and "workbook" etc., and didn't
seem to find anything such.
It is strange that the help entry says "you can't do that" but if Excel XP
operates according to the principle given above ("any macros ...are
available for the balance of the session), then...well, the help file is
wrong or at least misleading.
First you have to get to macros and the VBE.
First there's a bit of confusion about what a Macro is, exactly. To me, it
is a named concatenation of atomic operations, as a programmer sees in a
Macro Assembler environment. If you do the same series of simple,
indivisible operations often enough it makes sense to reference them
symbolically.
I've been programming in one version of Basic or another for ...a very long
time, and I think I know roughly what that means.
I guess that Macros are composed of Basic commands, and the "VBA" implies a
lot of application-specific operators have been added to the list of "basic"
Basic commands. Thus a Macro is a function subroutine, more or less, one
that can be invoked in immediate mode via a command line or included in a
program that will be executed "later".
And here's where MS has done Mac users a real disservice over the years. If
you've not used the built-in Help, start - it's not as good as the comparable
WinXL, but it's light-years better than it was in MacXL4/5, which is when Mac
users gave up and never looked back...
OK, I've loaded all the VBA help for both Win and OS X. Never needed it
before.
Historically, I've found Office help to be useless or worse. So much so that
I came to the conclusion that MS must be producing bad help completely on
purpose -- no one could do so badly by accident.
I've cited a few problems in this thread where it is misleading, but
--true-- it seems to be improving.
In general, I believe the design of modern GUI-based application should
reduce the need to make references to Help subsystems to a bare minimum.
Clearly, if you need detailed syntactical information, you need a reference
source. Even this can be partly covered by in-context help.
The very first topic in Help that you should search for is "help" -
it will give you a bunch of topics that will assist you in using
help.
OK. How about "index"?
If you look in XL Help, you'll find the topic "Macros: Automating
tasks you perform frequently", which will lead you to other topics
that introduce the VBE and editing macros.
Right. OK.
Note that VBA Help is not XL Help - you have to install it (but
that's explained in one of the topics in the "help" search.
Right.
Note: One must be able to make a leap from the Excel X error message
regarding the non-installation of VBA help to find the installer in the
Value Pack, a bit awkward, but surmountable.
Second note: Regular Excel X help doesn't even define the term "VBA"
according to Clippy. The least it could do is refer you to the VBA "mode"
help. There's that really difficult mode switching problem I mentioned
earlier. Do the Excel folks and the VBA folks work for the same company?
OK - in an ideal world, you'd look up mailto in XL help and be given
a page which describes hyperlinks. You can then look up hyperlinks
in VBA help to see how to use VBA to manipulate them.
Yup, exactly.
The absolute bar-none best way to learn about VBA is to record a
macro. The macro recorder writes absolutely terrible code (partly
because it's based on the particular cells you select/manipulate,
partly because it records what you did, but can't anticipate what
you mean to do), but it lets you get an idea what objects and
methods are involved.
This seems parallel to coding something in c so you can produce assembler
code that's usually equally terrible, so it is a familiar concept.
The problem for me is that I really have no idea why I would want to use
macros. This is the first case in which I have been given a good reason to
do so in Excel. This is a poor example, I think, because writing a macro
in this case is simply putting a wrapper around a single construct to do a
particular task, namely deleting all hyperlinks in the active worksheet.
Not exactly a coding challenge, but a conceptual one -- I simply can't
understand why the designers didn't implement hyperlink control in parallel
with a number of other preference-controlled items, a much simpler solution
and one that is much more accessible to the less technically adept.
When I recorded a macro of deleting a hyperlink in XL (ctrl-click the cell,
choose Hyperlinks, then click the Remove Hyperlinks button) this is what it
came up with:
Selection.Hyperlinks.Delete
This gets you 80% of the way there - you can use this macro as is on an entire
sheet - just select all the cells in the sheet first.
Right. This would be right-mouse click in Win, right?
There's a conceptual issue that you need to grasp when using VBA.
So it would seem.
Nearly everything in XL is made up of objects.
That's what I was afraid of, I'm willy-nilly falling into OOP.
Each object has Methods and Properties.
Terms which I have never succeeded in finding particularly descriptive, even
though the underlying concepts are quite reasonable.
In this case, the macro recorder recorded the use of the Delete method of the
Hyperlinks collection object (which is just a container for hyperlinks) of the
Selection object.
You just sneaked in the "container" metaphor... without definition. (I've
been through this with one of your colleagues on the Word side.)
I find a Mass in Latin more penetrable than this, and I'm not even Catholic.
Nevertheless, let me string together what you've expressed in summary form:
a) "hyperlink: ~= "mail to" thingie,
b) a hyperlink has properties (such as the value of the link itself), and
c) a hyperlink has standard things you can do it it, such as Delete
d) you can define scope of an operation, e.g. "Selection" or "WorkSheet"
e) there's a syntax for stringing these keywords together
If you look at the Hyperlinks collection object in Help, and click
on Applies To... you'll see that there are dozens of objects that
can have a Hyperlinks Collection object, among them a Worksheet
Object.
It is a bit difficult to do this because Excel Help goes out of context when
I switch to this context.
Yes, Clippy's first suggestion is "Hyperlinks Collection Object", but no,
there doesn't seem to be any "Applies to..." link in the reference page.
The last bit is realizing that ActiveSheet is a property of the
Worksheets collection object that refers to the currently active
workbook object. That's not necessarily intuitive, but it is
documented in the Worksheets object Help topic.
I guess.
It's a bit of an iterative process, just like learning any other
language/technique
Well, certainly, but it is one that requires a higher motivation that I
currently have.
I can't really - the Mac VBE is definitely not an IDE. Perhaps MS's
VBA101 (for Windows, but much of the info is the same - though Macs
lack Intellisense and the Local and Watch windows):
http://support.microsoft.com/default.aspx?scid=/support/excel/content
/vba101/default.asp
Sorry to say, that's like coming into a movie after it has already been
playing for an hour.
David McRitchie has a good, really basic, introduction to using VBA
with good links to other sites:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Same response. Different movie.
It's the version number: Office 98 is version 8, Office 2001 is
version 9, and, fortuitously, Office v.X is version 10. The next
version will be 11, though I've no idea what it will be called.
On the WinOffice side, version 8 is Office 97, version 9 is Office
2000 and version 10 is Office XP. Office 2003, which was just
(partially) released, is version 11.
I'm sorry I asked.
Thanks,
Henry
(e-mail address removed) remove 'zzz'