getMacroRegId displayed in Immediate window

B

bigHatNoCattle

Hi,

My app uses functions in the Analysis tool pack. I switched to Excel
2003 and now the Immediate window has the following junk. Does Excel
2007 have the same problem with this junk?

Below is the junk.

[auto_open] <
[SetupFunctionIDs] <
[SetupFunctionIDs] >
[PickPlatform] <
[PickPlatform] >
[VerifyOpen] <
[VerifyOpen] > 1
[RegisterFunctionIDs] <
[RegisterFunctionIDs] >
[auto_open] >
[GetMacroRegId] 'DEC2HEX' <
[GetMacroRegId] 'DEC2HEX' -> '1555300407' >
[GetMacroRegId] 'DEC2HEX' <
[GetMacroRegId] 'DEC2HEX' -> '-917438410' >
etc etc... about 10,000 times


Considering my app calls DEC2HEX about 10,000 times this makes the
Immediate window useless for displaying status messages from my VBA
program.

I know I can erase this stuff but I'm trying to get a solution so it's
not displayed in the first place.

Duane
 
J

John Coleman

Hi

Here is an idea (less than ideal but maybe better than nothing) -
create your own window for displaying status messages.

As an experiment I created a modeless userform (ShowModal set to
False) named frmStatus (and captioned "Status Window" but so what)
that contained nothing but a text box named tbStatus with multiline
set to true (I don't know if that was really needed) and Scrollbars
set to option 3. Then in a general code module I wrote:

Sub PrintStatus(msg As Variant)
frmStatus.tbStatus.Text = _
frmStatus.tbStatus.Text & msg & vbCrLf
DoEvents
End Sub

It is used like this (note the need to show the form explicitly in any
sub that wants to use it):

Sub test()
Dim i
frmStatus.Show
For i = 1 To 10000000
If i Mod 10000 = 0 Then
PrintStatus i
End If
Next i
End Sub

I agree that it is a shame that the Analysis tool pack trashes the
intermediate window so much, but hopefully the above could be of some
use.

-John Coleman
 
J

John Coleman

Another idea
It is possible to use the PrintStatus sub without first showing or at
least loading the userform (I would have guessed that it would have
thrown a run-time error). Evidently the first attempt to write
something to the textbox loads the form automatically. Thus - you can
simply comment out the line frmStatus.Show if you don't want the
status messages to be explicilty shown. Furthermore - if one of your
purposes of wanting to write to the immediate window is to keep an
informal log of a run to be looked at later, then you can write the
contents of the textbox to the immediate window just prior to exiting
your program. This will prevent the status messages from being
interspersed with the toolpack garbage. A possible use case could look
like:

Sub test()
Dim i
'frmStatus.Show 'comment out to record status silently
For i = 1 To 10000000
If i Mod 1000000 = 0 Then
PrintStatus i
End If
Next i
Debug.Print frmStatus.tbStatus.Text
Unload frmStatus 'comment this out if you want to show the window
End Sub

HTH

-John Coleman



Hi

Here is an idea (less than ideal but maybe better than nothing) -
create your own window for displaying status messages.

As an experiment I created a modeless userform (ShowModal set to
False) named frmStatus (and captioned "Status Window" but so what)
that contained nothing but a text box named tbStatus with multiline
set to true (I don't know if that was really needed) and Scrollbars
set to option 3. Then in a general code module I wrote:

Sub PrintStatus(msg As Variant)
frmStatus.tbStatus.Text = _
frmStatus.tbStatus.Text & msg & vbCrLf
DoEvents
End Sub

It is used like this (note the need to show the form explicitly in any
sub that wants to use it):

Sub test()
Dim i
frmStatus.Show
For i = 1 To 10000000
If i Mod 10000 = 0 Then
PrintStatus i
End If
Next i
End Sub

I agree that it is a shame that the Analysis tool pack trashes the
intermediate window so much, but hopefully the above could be of some
use.

-John Coleman

My app uses functions in the Analysis tool pack. I switched to Excel
2003 and now the Immediate window has the following junk. Does Excel
2007 have the same problem with this junk?
Below is the junk.
[auto_open] <
[SetupFunctionIDs] <
[SetupFunctionIDs] >
[PickPlatform] <
[PickPlatform] >
[VerifyOpen] <
[VerifyOpen] > 1
[RegisterFunctionIDs] <
[RegisterFunctionIDs] >
[auto_open] >
[GetMacroRegId] 'DEC2HEX' <
[GetMacroRegId] 'DEC2HEX' -> '1555300407' >
[GetMacroRegId] 'DEC2HEX' <
[GetMacroRegId] 'DEC2HEX' -> '-917438410' >
etc etc... about 10,000 times
Considering my app calls DEC2HEX about 10,000 times this makes the
Immediate window useless for displaying status messages from my VBA
program.
I know I can erase this stuff but I'm trying to get a solution so it's
not displayed in the first place.
Duane- Hide quoted text -

- Show quoted text -
 

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