Normal.dot keeps growing

G

Guido Kraus

I have a COM add-in for Word. It creates a custom CommandBar with a
CommandBarPopup that has several dozens subitems (CommandBarPopups and
CommandBarButtons). If the CommandBarPopup at the root of this customized
menu structure exists at startup the COM add-in deletes the root element and
recreates the whole menu structure.
Everything works fine except that Normal.dot grows by 80 KB at every restart
of Word. Even if you uninstall the add-in and manually delete my custom menu
bar Normal.dot keeps its current size.

The details:
In OnStartupComplete I search for my custom CommandBar and delete it if it
is found (cmdBar.delete()). Then I create my custom CommandBar which has one
CommandBarPopup (the root element of my menu structure):
cmdBar.Controls.Add(msoControlPopup). I do the same thing to create submenus
and submenu items.

Any idea why Normal.dot keeps growing?

Thanks,
Guido
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?R3VpZG8gS3JhdXM=?=,
I have a COM add-in for Word. It creates a custom CommandBar with a
CommandBarPopup that has several dozens subitems (CommandBarPopups and
CommandBarButtons). If the CommandBarPopup at the root of this customized
menu structure exists at startup the COM add-in deletes the root element and
recreates the whole menu structure.
Everything works fine except that Normal.dot grows by 80 KB at every restart
of Word. Even if you uninstall the add-in and manually delete my custom menu
bar Normal.dot keeps its current size.

The details:
In OnStartupComplete I search for my custom CommandBar and delete it if it
is found (cmdBar.delete()). Then I create my custom CommandBar which has one
CommandBarPopup (the root element of my menu structure):
cmdBar.Controls.Add(msoControlPopup). I do the same thing to create submenus
and submenu items.

Any idea why Normal.dot keeps growing?
1. Version of Word involved?

2. Are you using CustomizationContext before doing anything with the
CommandBars and their controls?

3. Is this happening on every machine, or just on certain ones?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
F

Fredrik Wahlgren

Guido Kraus said:
I have a COM add-in for Word. It creates a custom CommandBar with a
CommandBarPopup that has several dozens subitems (CommandBarPopups and
CommandBarButtons). If the CommandBarPopup at the root of this customized
menu structure exists at startup the COM add-in deletes the root element and
recreates the whole menu structure.
Everything works fine except that Normal.dot grows by 80 KB at every restart
of Word. Even if you uninstall the add-in and manually delete my custom menu
bar Normal.dot keeps its current size.

The details:
In OnStartupComplete I search for my custom CommandBar and delete it if it
is found (cmdBar.delete()). Then I create my custom CommandBar which has one
CommandBarPopup (the root element of my menu structure):
cmdBar.Controls.Add(msoControlPopup). I do the same thing to create submenus
and submenu items.

Any idea why Normal.dot keeps growing?

Thanks,
Guido

Waht happens if you rename this file. I believe a new file should be
created. Will the new one grow as well?

/Fredrik
 
P

Peter Huang [MSFT]

Hi Guido,

In addition to Cindy and Fredrik's suggestion, I think you may also try to
reset the toolbar by following the steps below.
1. right click on the toolbar and select Customize...
2. At the Toolbar tab, click Reset
You may perform the steps to see if that helps you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guido Kraus

Thanks for your suggestions. I'm using Word 2003 SP1 on Windows XP SP2. The
COM add-in was created with VB6 SP6.
My first approach was to delete and recreate my custom menu structure at
every startup of the add-in. Doing this lets Normal.dot grow by about 80 KB
every time Word starts. Since this takes a noticable amount of time I decided
to let Word save the custom menu structure in Normal.dot and now I delete and
rebuild the menu structure only on demand. However, once the user chooses to
rebuild the menu I need to delete it and rebuild it. If I just delete the
root CommandBarPopup Normal.dot again keeps growing by 80 KB. If I
recursively delete all elements of the Controls collection of the
CommandBarPopup (I wrote a procedure for that) then Normal.dot just grows by
5 KB - but it still keeps growing.

Here is the procedure that deletes my menu structure:

Private Sub RemoveControls(ctrls As Office.CommandBarControls)
Dim i As Integer
For i = ctrls.Count To 1 Step -1
Dim ctrl As CommandBarControl
Set ctrl = ctrls(i)
If TypeOf ctrl Is Office.CommandBarPopup Then
RemoveControls ctrl.Controls
End If
ctrl.Delete
Next i
End Sub

To answer Cindy's questions:
I don't use CustomizationContext in my code and yes the behavior is
reproducable on more than one PC (I tested it with Virtual PC and a clean
Windows XP SP1 / Office 2003 install).

Resetting the toolbar (as Peter suggests) does not work since the reset
button is only enabled if it's a built-in toolbar. However, my add-in creates
a custom toolbar with a CommandBarPopup that hosts my custom menu structure.
The only thing I can do from the 'customize' dialog is to delete the toolbar
(which does not shrink Normal.dot either).

Thanks for any further ideas,
Guido
 
P

Peter Huang [MSFT]

Hi

I think you may try to create a temporary commandbar variable, set it to
the commandbar of the control to be deleted, and only then deleting the
control. The example below illustrates this:

' 1.Set a temporary commandbar object to the command bar of the
control to be
deleted
' 2.Delete the control
' 3.Delete the command bar
Sub RemoveMenu()
Dim myControl As CommandBarPopup
Dim cmd As CommandBar
Set myControl =
Application.CommandBars.FindControl(Type:=msoControlPopup,
Tag:="MyAddin")
If Not myControl Is Nothing Then
Dim myCommandBar As CommandBar
Set myCommandBar = myControl.CommandBar
myControl.Delete 'delete the control
myCommandBar.Delete 'delete the command bar (control's parent)
End If
End Sub

NOTE: For a sequence of submenus, the method is to delete the submenus in
order of leaf to root. Delete the commandbar of the child before the parent.

You may have a try and let me know the result.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi Guido,

Thanks for your detailed information.
I found a similar case which said that the problem will be fixed in Word
2003 SP1.
Since you have already used SP1, to duplicate the issue exactly on my side,
can you help to send a reproduce Addin sample(source code and compiled dll)
together with detailed reproduced steps and the phenomena at your side.

I will appreciate your efforts, you may reach me via removing "online" from
my email address.
If you still have any concern, please feel free to post here.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi Guido,

I am sorry for delay response.
Currently I have reported the problem to our product team, and I will
update you with new information ASAP.
Thanks for your patience.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi Guido,

Sorry for deplay reponse.
So far our product team is still investigating the issue.
Thanks for your patience.



Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi Guido,

Currectly our product team is researching the issue.
Thanks for your patience.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Y

Yan-Hong Huang[MSFT]

Hi Guido,

Sorry for the late response. Peter is taking sick leave today.

Currently our dev team is still researching it based on the sample that you
sent to us. If there is any update, we will update you here.

By the way, you can use the following function to get a notification email
when there is any update on this thread. This address is stored privately
by Microsoft and is not visible to the community or third-party groups
http://msdn.microsoft.com/subscriptions/managednewsgroups/#notifications

Thanks very much for your patience.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
-http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.as
p&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 
P

Peter Huang [MSFT]

Hi Guido,

So far our dev team is still investigating the problem.
Due to the different support process between MSPSS and newsgroup, if you
are urgent with the issue, I strongly recommend that you contact MSPSS
directly via the link below.
http://support.microsoft.com

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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