Using a form as a progress bar

E

Edward Thrashcort

I want to display progress messages to a user while a macro is running

I have tried to set the Status bar but my messages get overwritten by system
messages (eg "Running a virus scan" when the macro opens a new document)

My idea was to use a non-modal dialog and a list box so I can add items to
the list box as the macro progresses. I'm having problems keeping visible
the latest item added to the list box. Once the box is "full", newly added
items scroll out of view!

How do I make the last item in a scrolled list box appear in the list box
"window"

or

has anyone got a pre-built progress message form that they are willing too
give to me?


Eddie
 
E

Edward Thrashcort

No, not much help there

I have just wasted 7 hours trying to use a temporary toolbar to display
messages (via a button descriptor) but there were too many "gotchas" to make
it viable.

My gut feeling is that there must be a "stay on top" dialog in the Windows
API that could be used but not being an expert in this sort of programming,
(although I have implemented several API calls from VBA in the past) I would
not know where to start looking.

Eddie
 
D

Doug Robbins - Word MVP

The site has been re-arranged a bit and no longer displays the information
so prominently, but you will find the basics for how to do it in the
database that you can down load by clicking on the appropriate link in the
Super Easy Word Merge item.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
H

Helmut Weber

Hi, Edward,

You could swap the last item in the listbox,
the one you've just added,
with the first item in the listbox.

A million ways to do that.

Dim sTmp As String
ListBox1.AddItem CStr(Format(ListBox1.ListCount + 1, "000"))
' remember first enty
sTmp = ListBox1.List(0)
' assign value of last entry to first entry
ListBox1.List(0) = ListBox1.List(ListBox1.ListCount - 1)
' assign value of remembered entry to last entry
ListBox1.List(ListBox1.ListCount - 1) = sTmp

' ------------------------------------

Though, for all progress indicators,
they can't work perfectly as there is some
uncertainty about future in general.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
E

Edward Thrashcort

Thanks for that, Helmut

Is there any way to keep a non-modal form "on top" while a document in the
underlying window is processed with "screenupdating=false" set?

Eddie
 

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