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 / November 2005

Tip: Looking for answers? Try searching our database.

Intercept Macro-Record Dialog

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Winfried Rabenstein - 14 Nov 2005 18:29 GMT
Hi,
I would like to limit the macro functionality of Word 2003 in such a
way that users can save their macros only to a particular template,
different from normal.dot. Two ways come to my mind, either modify the
Macro-Record Dialog so that the "normal.dot" template is not shown, or
(better) not show such a dialog at all but directly record to the
specified template. However, both solutions seem to be impossible as
one cannot access the record macro functionality from within a macro.
Does anyone have an idea???

Thanks,
Winfried
Charles Kenyon - 14 Nov 2005 20:50 GMT
I haven't tried it, but my idea would be to have an AutoExec macro switch
the customization context to your template. I don't know how sticky this
setting is, but believe it stays set until something else changes it or you
restart Word. This would _not_ keep the person from saving to normal.dot,
but would change the default, if it works.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Hi,
> I would like to limit the macro functionality of Word 2003 in such a
[quoted text clipped - 8 lines]
> Thanks,
> Winfried
Jezebel - 14 Nov 2005 22:35 GMT
Be very wary of the CustomizationContext setting. There is a sequence of
events involving it that irretrievably corrupts the current template.

>I haven't tried it, but my idea would be to have an AutoExec macro switch
>the customization context to your template. I don't know how sticky this
[quoted text clipped - 13 lines]
>> Thanks,
>> Winfried
RichardtVejeMadsen - 15 Nov 2005 09:30 GMT
Please inlight us - how is it corrupting the current template? I am
asking because I am building a menu by code and this corrupts my
template to (and Microsoft are working on the problem, but I have not
seen a solution yet)

Richardt
Teknologisk Institut (Denmark)
Jezebel - 15 Nov 2005 11:16 GMT
I didn't pursue this in detail (I got sick of restoring templates from
backup), but the sequence was along the lines of --

1.  Make a toolbar change to template A
2. Set the CustomizationContext to template B
3. Reset the toolbar change to template A.

At this point template B disintegrates. I'm sorry I can't recall further
detail. At the time, we just decided to work around the problem entirely and
design out the need to use the context at all.

> Please inlight us - how is it corrupting the current template? I am
> asking because I am building a menu by code and this corrupts my
[quoted text clipped - 3 lines]
> Richardt
> Teknologisk Institut (Denmark)
Tony Jollans - 15 Nov 2005 12:57 GMT
I'm interested in pursuing this further.

There are certainly some 'funnies' with toolbar customization but I wasn't
aware of any problems with Customization Context per se.

Jezebel - How do you reset toolbar changes in template A after changing
customization context to template B?

Richardt - Any chance you could give a brief description of the steps you
are taking.

--
Enjoy,
Tony

> I didn't pursue this in detail (I got sick of restoring templates from
> backup), but the sequence was along the lines of --
[quoted text clipped - 14 lines]
> > Richardt
> > Teknologisk Institut (Denmark)
Jezebel - 15 Nov 2005 20:36 GMT
As I said, I can't remember this in detail, but something like --

- Create Template A. Add a toolbar to it, with some buttons on it. Save and
close.

- Create a document using template A. The custom toolbar is displayed. Make
a change to it.

- Set the CustomizationContext to template B.

- Undo the change to the template A toolbar.

Zappo.

> I'm interested in pursuing this further.
>
[quoted text clipped - 30 lines]
>> > Richardt
>> > Teknologisk Institut (Denmark)
RichardtVejeMadsen - 16 Nov 2005 10:58 GMT
Put this code in a template in Words StartUp library. Open and close
Word - se Normal.dot getting bigger and the Autotext corrupt:

Sub AutoExec()

   Dim FillBar As Office.CommandBar
   Dim popupBar As Office.CommandBarPopup
   Dim TopLevels As Long
   Dim NextLevels As Long

   With ThisDocument.CommandBars.Add(Name:="FILL")
       .Visible = True
      For TopLevels = 1 To 5
          For NextLevels = 1 To 50
              With .Controls.Add(Type:=msoControlPopup)
                 .Caption = "Filling up the word menu space"
              End With
          Next NextLevels
      Next TopLevels
   End With
   Application.CommandBars("FILL").Delete
End Sub
Tony Jollans - 15 Nov 2005 13:02 GMT
Hi Winfried,

Your options when recording a macro are:

(a) Normal Template
(b) ActiveDocument
(c) ActiveDocument's Template (if different from Normal)

You can't record directly to a global template so what exactly are you
looking to do?

--
Enjoy,
Tony

> Hi,
> I would like to limit the macro functionality of Word 2003 in such a
[quoted text clipped - 8 lines]
> Thanks,
> Winfried
Winfried Rabenstein - 16 Nov 2005 07:53 GMT
Tony Jollans schrieb:

> Hi Winfried,
>
[quoted text clipped - 10 lines]
> Enjoy,
> Tony

Hi Tony,

thanks for stating this so clearly, I thought I understood this, but
was not 100% sure. The thing with the context change discussed here
appears too dangerous for me, and does not really solve my problem.

We change from WordPerfect 6.1 (!!! 10 years old) to Word, and I am
somewhat frustrated to see that what is easy to realize in WP in
different ways does not seem to be possible in Word.

We have a lot of users running a certain Word application (call it
"App") based on a particular template (AppTemplate, limiting largely
the formatting possibilities and containing functionality / macros).
This template is regularly updated , i.e. the users must absoultely not
save macros on this template (would be lost during update). However, I
do not like the users to save macros (which are only relevant for App)
on the general normal.dot, either. In fact, I don't even want the users
to be able to play macros from normal.dot, as this could corrupt the
documents created with App. I found a way to list macros from another
template (e.g. add-in), so I could limit users to run only these
macros, but I don't find a way to record them there.
Whereas in WordPerfect, you can save macros as separate files on the
disk, or you could use different standard templates (corresponding to
normal.dot) for different program sessions and save the macros there,
in Word there seems to be no way. :(

Regards,
Winfried
 
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.