开发者

Disable or Override Ribbon/CommandBar commands in MSWord using VBA

开发者 https://www.devze.com 2022-12-14 05:31 出处:网络
First of all I\'m going to state right out that I\'ve never worked with VB in the context of coding macros before - my skills lie in other areas (PHP, Javascript, getting there with C#, etc). However,

First of all I'm going to state right out that I've never worked with VB in the context of coding macros before - my skills lie in other areas (PHP, Javascript, getting there with C#, etc). However, I've been asked by a colleague to lock down a document so that the user cannot change font faces, sizes or colours 开发者_StackOverflow社区but does still have access to bold, italic, underline etc.

I started out by protecting the document and restricting formatting but this is far too restrictive - effectively only allowing the user to apply premade styles - which is going to be unintuitive for the users who are not used to working with styles.

So I've resorted to trying to writing a macro to do the job, but unfortunately I'm at the really pointy end of the learning curve and I honestly don't know where to start.

You're going to laugh at me but so far this is all I have in my ThisDocument.

Private Sub Document_Open()

End Sub

Ermmmm... help!

Cheers

Iain


Iain, this is a pretty common need. Here's a good information page on what will get you started: Using VBA to Control Built-In Commands in the 2007 Office System


I think you could write a macro that removed tools from the toolbar, menus, maybe even keyboard shortcuts. Not sure how you'd reverse it though when they opened another document.

Maybe a better solution is to use an application to edit only certain text fields that you define and which ultimately change text in a word document?

0

精彩评论

暂无评论...
验证码 换一张
取 消