Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 26th, 2004, 12:12 AM
Authorized User
 
Join Date: Jul 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regarding Visual basic editor

I don't want the user to access the vbe ? how to do it in word.
I have set the showvisualbasiceditor to false. But the user can go to tools and select macro and then can edit the vbe code.
I don't want this to happen how will you do it .

Kind Regards
Hari




 
Old July 26th, 2004, 04:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, you could always remove the Macro option from the Menu on loading the document. But remember to leave yourself a way back in :).

chris

There are two secrets to success in this world:
1. Never tell everything you know
 
Old July 26th, 2004, 11:17 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you have Office XP or greater I believe you can set this in your admin tools as a group policy for all Office applications. This would be the most elegant solution, I think

if not, rather than messing around with removing/disabling toolbar menus, disable the internal Word functions directly.

First create a global Word template (eg. "lockDownVBEditor.dot") and place this in your Word Startup folder. Then, inside this project, create a module and add the following procedures.

Code:
Public Sub ToolsMacro()
'
End Sub

Public Sub ToolsRecordMacroToggle()
'
End Sub

Public Sub ViewVBCode()
'
End Sub
These act as overrides to built-in Word functions. You could replace the comment so that it warns the user that these features are disabled.

Of course, this isn't foolproof, but it's a hack that deters most users.

cheers,
Guido
 
Old July 27th, 2004, 01:23 AM
Authorized User
 
Join Date: Jul 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How to disbale the macro option in tools menu. I have to do this only to the active document and not to the whole application.

Kind Regards
Hari


 
Old July 29th, 2004, 02:46 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

to do it by specific document either include the following code in your document (if it is a one-off), or place it in a global template and perform a switch depending on the active document

Code:
Option Explicit

Public Sub AutoOpen()
  Call setVBEditorOptionState(False)
End Sub

Public Sub AutoClose()
  Call setVBEditorOptionState(True)
End Sub

Public Sub setVBEditorOptionState(enabledState As Boolean)
  Dim c As Office.CommandBarButton
  Dim bDirty As Boolean
  Application.CustomizationContext = NormalTemplate
  bDirty = NormalTemplate.Saved
  Set c = CommandBars("Tools").FindControl(ID:=1695, Recursive:=True)
  If Not c Is Nothing Then
    c.Enabled = enabledState
  End If
  NormalTemplate.Saved = bDirty
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Geting a php editor in visual studio 2005 wambozi PHP How-To 1 August 29th, 2006 11:12 PM
FTP in Visual Studio 2005 Pro (Visual Basic) shoopes VB How-To 1 June 29th, 2006 02:08 PM
Visual Basic Editor saves only sometimes crmpicco Excel VBA 0 May 10th, 2005 08:43 AM
Invoking Visual Basic Editor terminates Access laicm Access 1 October 19th, 2004 07:31 AM
hot spot set in image editor visual studio c++ mateenmohd Visual C++ 0 June 18th, 2003 05:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.