Stack Space

L

LadyDungeness

Is this the right newsgroup foro my questions?
I'm using Word XP on Windows XP. I'm starting to work with macros. It's all a bit less than intuitive. I've recorded
and edited a few macros successfully. I've debugged one or two.
When I try to run one of the macros, I get error #28, Out of Stack Space. I have to use the Task Manager to shut down
Word. What is this error? How can I fix it?




Lady Dungeness
Crabby, but Great Legs!
~~~~~~~~~~~~~~~~~~~~~~~
 
J

Jonathan West

Is this the right newsgroup foro my questions?
I'm using Word XP on Windows XP. I'm starting to work with macros. It's
all a bit less than intuitive. I've recorded
and edited a few macros successfully. I've debugged one or two.
When I try to run one of the macros, I get error #28, Out of Stack Space.
I have to use the Task Manager to shut down
Word. What is this error? How can I fix it?

We would have to see the code.
 
K

Karl E. Peterson

When I try to run one of the macros, I get error #28, Out of Stack Space. I have
to use the Task Manager to shut down Word. What is this error? How can I fix it?

Typically, that means you've entered a situation where two or more routines are
calling each other non-stop, or even a single routine is recursively calling itself.
Sometimes, these situations are non-intuitive. You could try putting a breakpoint
in the suspected problem routine (with F9), then use F8 to single step through it
one line at a time, to see if the logic error becomes obvious. As Jonathan
suggests, for us to do more than offer the crudest of guesses (as above), you'd have
to provide the code that's causing the failure.
 
L

LadyDungeness

That sounds like a good idea.

How to I add a break point?

Do you mean that I can use F8 to run a macro bit by bit? What command do I access from the toolbar in order to invoke that
procedure?


Lady Dungeness
Out of Danger until September
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 
J

Jonathan West

That sounds like a good idea.

How to I add a break point?

Do you mean that I can use F8 to run a macro bit by bit? What command do
I access from the toolbar in order to invoke that
procedure?

When you have a document open in Word, press Alt-F11 to open the Word VBA
editor. Position the cursor at the start of the macro you want to run step
by step, and then press F8. The crrent line will be shown with a yellow
highlight. Press F8 again and the highlight will move to the next line.
 
K

Klaus Linke

And to set a break point, use F9.
Or click in the left margin of the line of code.
(Do that again to remove the break point)

When you run the macro, it'll stop at that line and will let you debug it.
What command do I access from the toolbar in order to invoke that
procedure?

Single-stepping and setting break points (and more) can be found in the
"Debug" menu.

Klaus
 
L

LadyDungeness

Cool! Two of my favorite helpers, too. :)

Actually, I had stumbled across the break points. I thought they were there to make the macro easier for me to read. LOL. I
can make good use of that technique.

I think I'm going to like learning macros almost as much as I like typesetting in Greek and Ichishkiin.


Lady Dungeness
Out of Danger until September
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 
J

Jean-Guy Marcil

Cool! Two of my favorite helpers, too. :)

Actually, I had stumbled across the break points. I thought they were there to make the macro easier for me to read. LOL. I
can make good use of that technique.

Also, sometimes, I find it very useful to see what is going on in the
document as I debug. So, I size the VBA Editor window so that it as wide as
the screen, but barely 10% of the height or so. Then I place it at the
bottom. Then I size the Document window to use the rest of the screen space.
This way, when I debug by stepping through the code, I can see what is
hapenning in the document.

Sometimes, before hitting F8 to go on to the next line, I go into the
document, change the selection, undo the last action, add text... etc. Then
in the VBA window, I drag the yellow arrow back to the line I just executed
and execute it again to see if a different environment has an impact or not.
Alternatively, sometimes I add code above/below the line I just executed,
then I undo the last action in the document window and drag the yellow arrow
to the beginning of the new code to see its impact.

All this is to help me find better solutions to problem I observe, but
without having to run the code from the start every time I try something new,
this is particularly useful with longer/complex macros.

Good luck!
 
J

Jonathan West

Jean-Guy Marcil said:
Also, sometimes, I find it very useful to see what is going on in the
document as I debug. So, I size the VBA Editor window so that it as wide
as
the screen, but barely 10% of the height or so. Then I place it at the
bottom. Then I size the Document window to use the rest of the screen
space.
This way, when I debug by stepping through the code, I can see what is
hapenning in the document.

I have two screens, one for the document, one for the code. Very useful for
serious development!
 
K

Karl E. Peterson

Jonathan said:
I have two screens, one for the document, one for the code. Very useful for
serious development!

Definitely. I get *sooooo* frustrated when I'm limited to one, anymore!
 
L

LadyDungeness

great suggestions. Thanks!

Two screens -- you mean two monitors? I'd love to do that. My motherboard is about 9 years old though, so I'm not sure if
it would work. I don't know how to hook up more than one monitor. There's only one of the ports for the monitor cables.

Oh well.

Split screen is a good idea. The VBA editor is kind of clunky -- or else I haven't figured out a good way to mess around in
there.


Lady Dungeness
Out of Danger until September
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
 
J

Jean-Guy Marcil

great suggestions. Thanks!

Two screens -- you mean two monitors? I'd love to do that. My motherboard is about 9 years old though, so I'm not sure if
it would work. I don't know how to hook up more than one monitor. There's only one of the ports for the monitor cables.

Oh well.

"Oh well" is right, I'm afraid...
You would needd to change your video card to get one that supports two
monitors (Most video cards do that nowadays), but I do not think you will
find one that is compatible with your antediluvian CPU! Unless you look
around in second-hand part stores... Which is not really worth it...
Split screen is a good idea. The VBA editor is kind of clunky -- or else I haven't figured out a good way to mess around in
there.

clunky? What do you mean?
When I work in a split screen fashion, I do not have any problems (We can't
all be spoilt and have two monitors!)...
 
J

Jonathan West

great suggestions. Thanks!

Two screens -- you mean two monitors?

Exactly so. Two nice big 19" monitors side-by-side :)
I'd love to do that. My motherboard is about 9 years old though, so I'm
not sure if
it would work. I don't know how to hook up more than one monitor.
There's only one of the ports for the monitor cables.

Oh well.

Unless you go for the extreme budget end, newer PCs usually have two video
output sockets, one for conventional SVGA and one for the new digital DVI
output. You can buy a DVI-SVGA converter for a few dollars and then hook up
a monitor to each one.

Failing that, it is possible to buy an additional graphics card and fit it,
and hook up the extra monitor to that, though as Jean-Guy suggests, you may
need to be careful about compatibility with your existing system. Ask at the
shop.

A further option is to buy a laptop. Most laptops have an external video
output into which you can plug an extra screen, and you can set it up so
that both the built-in and extra screens are working at the same time.
Split screen is a good idea. The VBA editor is kind of clunky -- or else
I haven't figured out a good way to mess around in
there.

It is an application in its own right. It takes a while to learn it. Don't
assume that things wok there the sme as they do in Word itself - the VBA
editor was used for the standalone verion of VB long before VBA was
integrated into Office, and the VB people had their own way of doing things
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top