I am using this function to copy a sheet from a Workbook to another Workbook.
 I works, but it seems that if I disable the macros from Workbook, 
 it can not copy the sheet anymore.

If I chage this line : `m_objExcel.AutomationSecurity = msoAutomationSecurityForceDisable`

to this `m_objExcel.AutomationSecurity = msoAutomationSecurityByUI`

it works but gets a warning message.
Also if I comment the line it works perfectly but with macros On.

```
Private Sub CopyFunction() 
    Set m_objExcel = New Excel.Application 'creare obiect
    m_objExcel.DisplayAlerts = False 

    g_secAutomation = m_objExcel.AutomationSecurity
    m_objExcel.AutomationSecurity = msoAutomationSecurityForceDisable
    m_objExcel.Visible = True

    Dim CopyFrom As Workbook
    Dim CopyTo As Workbook
    Dim CopyThis As Object

    Set CopyFrom = m_objExcel.Workbooks.Open("D:\FromFile.xls")
    Set CopyTo = m_objExcel.Workbooks.Open("D:\ToFile.xls")

      Set CopyThis = CopyFrom.Sheets(1) ''Sheet number 1
      CopyThis.Copy After:=CopyTo.Sheets(1)

    m_objExcel.Workbooks(CopyTo.FullName).Save
    CopyFrom.Close
    CopyTo.Close
    m_objExcel.Workbooks.Close
    MsgBox "ok"
    End Sub

```

I am using it from Access and work with a Excel file.
What is the problem? 
Is there a way to still be able to copy a sheet from a workbook to another, and have the macros disabled?