Macro Security

  • Thread starter Thread starter will07
  • Start date Start date
W

will07

Hi, Can any body tell me if there is a code I can use that will set the
Macro Security to low when the workbook is opened and then return to high
when the workbook is shut down. I work on a network where the default is set
to high.

thanks
 
If you could use code to set security to low, security settings would be
useless as a tool to prevent malicious code.

If security is high, unsigned workbooks won't run code so how would you get
the code to run in any case?


Gord Dibben MS Excel MVP
 
People forget the SQL's are long strings try this

SelectSQL = _
"SELECT DISTINCT v_inputfiles.sName AS 'Client Name'," & _
"ciSE.ciSEqty," & _
"ciSE.ciSEvalue," & _
"ciSE.ciSECharge," & _
"ciSE.ciSEInRefSource," & _
"ciSE.ciSEInRefData"

FromSQL = _
"FROM chronosv2.dbo.ciSE ciSE," & _
"chronosv2.dbo.v_inputfiles v_inputfiles"

WhereSQL = _
"WHERE ciSE.ciSEclient = v_inputfiles.sID AND " & _
"((ciSE.ciSEbillingmonth='2008-10'))"

GroupSQL = _
"GROUP BY v_inputfiles.sName, " & _
"ciSE.ciSEID, " & _
"ciSE.ciSEqty, " & _
"ciSE.ciSEvalue, " & _
"ciSE.ciSECharge, " & _
"ciSE.ciSEInRefSource," & _
"ciSE.ciSEInRefData"

HavingSQL = _
"HAVING (ciSE.ciSEInRefSource='TM') AND (ciSE.ciSEInRefData='ELIST')"

Sql = SelectSQL & FromSQL & WhereSQL & HavingSQL
 
did you try to overdrive your excel file with vb script.
something like this:

'Dim ex As Excel.Application 'Application Excel
'Dim wb As Excel.Workbook 'Classeur Excel
'Dim ws As Excel.Worksheet 'Feuille Excel

Set ex = CreateObject("Excel.Application")
ex.Visible = True
Function GetPath()
Dim path
path = WScript.ScriptFullName
WScript.Echo path
GetPath = Left(path, InStrRev(path, "\"))
End Function
p=getpath()
Set feuille = ex.Workbooks.Open(p &"\your_excel_file.xls")
set wb=ex.activeworkbook
Set ws = wb.ActiveSheet
ex.run "macro1",5
wb.save
wb.Close 'Fermeture du classeur Excel
ex.Quit'Fermeture de l'application Excel

Set ws = Nothing
Set wb = Nothing
Set ex = Nothing
 
Back
Top