473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VB.Net COM Add-in for MS Wors 2003 Beta problem

Hi All,

I am currently working on a project, which involves
creating a COM Add-in using VB.Net, for MS Word 2003.

As usual, I am creating few custom menu buttons under the
File and Tool menus. These menu buttons are being created
in the OnStartupComplete event and removed in the
OnBeginShutdown event of the COM Add-in's connect class.
So, as per logic, everytime the Word starts, custom menu
buttons should get created, and on closure they should get
deleted.

Now my problem is that when I install the add-in and run
MS Word, i can see the custom created buttons. But when i
close the MS Word, the custom created buttons are not
getting deleted. I have checked this.... i.e. i un-
installed the COM-Add-in and run MS Word...the earlier
created custom menu buttons are still there! ...... and as
per logic, since Word is deleting them everytime COM Add-
in is closed, they should have not been there .....

I tested whether the menu buttons are being deleted in the
OnBeginShutdown....and they were...but some how...they
were being deleted temporarily.....and not permanentlly.

I wud like to mention here .. that I am using
CommandBarControl and CommandBar objects to create the
custom menu items. Also, I am using temporary=true
parameter while adding the commandbarcontrol.

Hence, i wud like to request u to kindly help or guide me
on this issue.

......its very urgent and I have already wasted lot of time
on it!

Thanxs in advance for ur kind help!!!

Jassi
Nov 20 '05 #1
3 3930
Hi Jitender,

You don't mention whether you're setting a
CustomizationContext before creating/deleting the
CommandBarButtons. Note that the temporary argument does NOT
work for CommandBarButtonControls.

Word can save changes to commandbars in four different
"places", and if you don't specify, what it chooses as the
default when you create may not be the same default Word
decides to use to delete. So things won't get deleted. I see
this question, oh, maybe once a week when cruising the
Developer groups.
As usual, I am creating few custom menu buttons under the
File and Tool menus. These menu buttons are being created
in the OnStartupComplete event and removed in the
OnBeginShutdown event of the COM Add-in's connect class.
So, as per logic, everytime the Word starts, custom menu
buttons should get created, and on closure they should get
deleted.

Now my problem is that when I install the add-in and run
MS Word, i can see the custom created buttons. But when i
close the MS Word, the custom created buttons are not
getting deleted. I have checked this.... i.e. i un-
installed the COM-Add-in and run MS Word...the earlier
created custom menu buttons are still there! ...... and as
per logic, since Word is deleting them everytime COM Add-
in is closed, they should have not been there .....


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

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

Nov 20 '05 #2
Hi Jitender,
But there is one small problem, at the time of menu addition in
OnStartupComplete... it is saving the custimization in Normal.Dot
file...but while menu deletion in OnBeginShutdown, things are not
getting saved implicitly..i.e. i have to give NormalTemplate.Save()
explicitly inorder to save the menu deletion in Normal.Dot.

Is it the way it works?

Put very simply, yes: this is the way it works.

More background: when you make changes to the NormalTemplate
(Normal.dot), Word won't ask or warn anyone about saving these until
the users quits Word. Then, depending on whether the option to prompt
to save changes to Normal.dot is activated (Tools/Options/Save), the
user may get a prompt to this effect. (Default if the option is not
activated is to save any changes.)

You run into a potential conflict with the user, here, if you try to
answer this question yourself at the END of the session, because the
user may well have added AutoText entries, macros, keyboardshortcuts
or their own menu customizations. Or may have been "playing" with
this kind of thing and be counting on NOT saving the changes. You
have no way of knowing. Unless, of course, you are fully controlling
this instance of Word (but then you could run into conflicts if the
user has a second instance running, because they will share
Normal.dot.)

Note that if you're certain no changes whatsoever should be saved to
the NormalTemplate, you can set NormalTemplate.Saved = True so that
Word ignores any changes; the prompt would not appear. (This does NOT
save changes, just changes what we used to call the "Dirty" flag.)

Due to this Word "idiosyncracy" with Normal.dot, it might be better
to supply your own Addin template, or create the document in which
the user will be working with your application from your own, special
template. This would also have the advantage that you wouldn't have
to repeatedly create and destroy toolbars, as they could be saved
directly in the template file...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

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

Nov 20 '05 #3
Hi Cindy,

Thanxs for ur reply.... I got ur point and i appreciate ur positive
response.

Though I might be bugging u and I am sorry for the same... but I have
one more query related to the topic...

I understand.. that in order to run a COM add-in in MS Word, which is
developed in VB.Net.... we need to have a certified custom shim
developed in VC++.Net... otherwise when the security is set at high our
add-in will not be loaded by the word coz u cant certify mscoree.dll
(though u can certify mscoree.dll, but there are other associated risks
involved with that)..

Now, I have gone though MS documentations, that u can develop a COM
Add-in shim in VC++.Net as well as in VB 6.0 ...I have
downloaded/accessed lot of material as well as source code for VC++.net
shim, but none for VB 6.0

Hence, do u have any idea as, what should I do to develop a COM Add-in
Shim in VB 6.0? If u have some sample code or site URL...kind advise me
of the same.

T&R!!!

Jassi

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mike L | last post by:
I have two questions. 1) What is the code to check if datagrid already has a datasource? When the user clicks "ADD" button I want to add a record to the data grid, if the user clicks "ADD"...
4
by: Maarten | last post by:
i have the folowing code to setup my datagrid collumns Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load gridsetup() end sub
8
by: Yuk Tang | last post by:
I am tearing my hair out over this, since I can't see what I'm doing wrong (duh, if I knew, I wouldn't be asking the question). I am adding Field items to a Field Collection, but for some reason...
0
by: herman404 | last post by:
Hi everyone, I'm trying to dynamically add 3 button columns to a DataGrid object that I have on an ASP.net webpage, but I don't see any documentation on how to do it. I've seen plenty of examples...
3
by: Greg Scharlemann | last post by:
I'm not sure the best way to accomplish this... my hunch is with javascript, but I'm not sure if using server side code (PHP) would be easier. I'm adding people to a database. People have a...
2
oll3i
by: oll3i | last post by:
public class Kwiaty { private List<Kwiat> lista_kwiatow = new ArrayList<Kwiat>(); RozaCzerwona roza_czerwona = new RozaCzerwona(); RozaBiala roza_biala = new RozaBiala(); RozaZolta roza_zolta...
1
by: Sri Nanduri | last post by:
Hi , I am new to JS. Please help me to resolve my issue. 1.When the form loads there are two DropDown boxes and a ADD button. 2.When I click the add button it will add two DropDown boxes and a add...
0
by: anureddy | last post by:
help me how to add datagridview columns to another table,using windowsapplications. and set the displaymember and value member datagridviewcomboboxcolumn. i used this below code but that not...
3
by: guilherme21922 | last post by:
I created a new dropdownlist with the event selectedIndexChanged, but he never dispared!! what i am doing wrong? Thanks for (int i = 0; i < 2; i++) ...
2
by: Question123 | last post by:
<root> <Element> <add key="1" value="1"/> <add key="2" value="2"/> <add key="3" value="3"/> <add key="4" value="4"/> </Element> <Items>
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.