Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script to modify Excel Security macro from High to low

Status
Not open for further replies.

Jimmy24

IS-IT--Management
Sep 7, 2006
21
US

Dear Sir or Madam,

I have the following excel macro that copyies our employee phone list. We have about 17,000 user that are using this form. The problem I am having is the security tab under tools==> macros==>security is setup to high to all 17,500 user. Would you please be so kind and tell me if I can add a script to the below script that ignores the macro high level or put that macro security level from high to low without doing manualy.

Appreciate very much your assistance.

James


*********************starts here********
Sub copydata()

' copydata Macro

Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.ClearContents
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1394
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 2
Workbooks.Open Filename:= _
"H:\RECPT\Employee List\Emp phone directory list.xls"
Range("A2").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.Copy
Windows("Emplisttemplate.xls").Activate
ActiveSheet.Paste
End Sub
 
That would kind of nullify the whole point of security, wouldn't it?

If you could use a macro to enable macros, malicious coders would use that as a way to deploy viruses.



[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
You ask "if".
Would you please be so kind and tell me if I can add a script to the below script that ignores the macro high level or put that macro security level from high to low without doing manualy.
The answer is...NO. That would rather put a dent in the point of having Security set as High, wouldn't it? It is High precisely so you can't do that. It would not be High Security if anyone could just toss in a few script lines and change it.

If you have a digital certificate, then you can run code with Security as High.

Gerry
My paintings and sculpture
 
How do you expect your code does anything with a high level macro security ?
You may try to open your spreadsheet with VBS (typed, untested):
Set oXL = CreateObject("Excel.Application")
oXL.Visible = True
oXL.AutomationSecurity = msoAutomationSecurityLow
oXL.Workbooks.Open "\path\to\yourWorkbook.xls"
oXL.Run "copydata"
...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
this works for me -
call your excel spreadhsheet via an EXE program - you will have to write the EXE program using Microsoft VB6 or Visual Studio. The EXE program should open a top level menu and then have the user click to open the excel spreadsheet. Now even if the excel sheet has macros the user will not be prompted to change their security level. The top level menu can be closed leaving just the excel sheet running.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top