Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

Controls versus commands?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chuck - 30 Nov 2004 19:55 GMT
We've got a problem with external code where the external developers have
created an add in that intercepts FileSave and FileSaveAs but seems to
disable Ctrl+S to save files ONLY if users have dragged the File SaveAs
command onto a command bar.  

Looking at the code in the add in, the external developers have chosen to
bind a command bar control to an object and then execute the object instead
of simply using ActiveDocument.Save or ActiveDocument.SaveAs (or object.save
or whatever).

Question -- what is the rationale for binding an object to a command bar
control (see below) instead of simply using ActiveDocument.Save or
object.Save?  

   Sub FileSaveBinding()
   [snip]
   Set objSave = Word.CommandBars("File").FindControl(ID:=3)
   objSave.Execute
   [snip]
   End sub

   Sub FileSaveAsBinding()
   [snip]
   Set objSaveAs = Word.CommandBars("File").FindControl(ID:=748)
   objSaveAs.Execute
   [snip]
   End sub

Note:  This is a bit of a repost from a previous thread.  (There seemed to
be some confusion in the previous thread about what I was asking -- the
question we're trying to answer here is about coding practice -- why bind an
object to a command bar control and then execute the object rather than
simply using a Save/SaveAs command -- *not* about when/how to use buttons on
command bars.)

Thanks for any thoughts!
Word Heretic - 01 Dec 2004 09:28 GMT
G'day "Chuck" <Chuck@discussions.microsoft.com>,

It is compatible with more versions of Word.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

Chuck reckoned:

>We've got a problem with external code where the external developers have
>created an add in that intercepts FileSave and FileSaveAs but seems to
[quoted text clipped - 32 lines]
>
>Thanks for any thoughts!
Chuck - 01 Dec 2004 16:39 GMT
Thanks Steve.  Seems a bit counterintuitive to me to bind to command bar
controls rather than commands (seeing as how the control ID numbers aren't
self-explanatory and could possibly change) but live and learn!

> G'day "Chuck" <Chuck@discussions.microsoft.com>,
>
[quoted text clipped - 43 lines]
> >
> >Thanks for any thoughts!
Word Heretic - 02 Dec 2004 22:59 GMT
G'day "Chuck" <Chuck@discussions.microsoft.com>,

Yar - see those button ids havent changed in so many versions of word
it aint funny - whereas everything else has changed :-)

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

Chuck reckoned:

>Thanks Steve.  Seems a bit counterintuitive to me to bind to command bar
>controls rather than commands (seeing as how the control ID numbers aren't
[quoted text clipped - 47 lines]
>> >
>> >Thanks for any thoughts!
Chuck - 03 Dec 2004 12:51 GMT
Ah, good to know.  I was going to ask where I could get a list of the control
id numbers but I found a macro in the MS Knowledgebase that generates a list
(KB article 243988, at
http://support.microsoft.com/default.aspx?scid=kb;en-us;243988).

> G'day "Chuck" <Chuck@discussions.microsoft.com>,
>
[quoted text clipped - 59 lines]
> >> >
> >> >Thanks for any thoughts!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.