以前程序都沒有問題,但現在出問題了,程序不能打開Excel文件?當我在資源管理器打開Excel文件時,有這樣的提示:
在這個活頁簿的巨集停用了,因為安全性層級為高,而巨集沒有電子簽章或檢驗為安全。要執行巨集,您可以使用電子簽章或變更安全性層級。我是認為程序不會有問題,是文件的安全性問題,但什麼解決呢?有誰遇到過這個問題,什麼解決告訴我一下。謝謝!

解决方案 »

  1.   

    Office 2002以上的版本都加了宏(台湾叫巨集)的安全性来提高防病毒功能,把宏的安全性降为中就可以了。
      

  2.   

    to  sunjian_qi(sonne) :怎樣把宏的安全性降为中?在哪裡操作?
      

  3.   

    手工修改宏安全性:
    打开Excel--〉工具--〉选项--〉宏安全性(巨集安全性)--〉中
      

  4.   

    差了一步,呵呵:打开Excel--〉工具--〉选项--〉安全性--〉宏安全性(巨集安全性)--〉中
      

  5.   

    to  sunjian_qi(sonne) :
    我已經把安全降為“中”,但程序還是用不了,請再幫我看看。
    Dim strFormalPath As String = ConfigurationSettings.AppSettings("ServerAccPath")
    Dim strTempPath As String = ConfigurationSettings.AppSettings("ServerTempPath")
    Dim strFormatFile As String = strFormalPath & "ProductShipment.xls"
    Dim strTempFile As String = CreateTempFile(strFormatFile, strTempPath)  ----->這一行出錯
    Dim xlApp As New Excel.Application()
    Dim xlBook As Excel.Workbook = xlApp.Workbooks.Open(strTempFile)在服務器上運行時,錯誤提示:
    Mothod not found:Excel Workbook Excel.Workbooks.Open(System.String,System.Object,......)
      

  6.   

    Dim xlApp As New Excel.Application()
    --------------------------------------------
    能创建成功吗?感觉象丢了什么组件....
      

  7.   

    to:  lemong(風之影) 不是你說的那句出錯,是下面語句出錯的
    Dim strTempFile As String = CreateTempFile(strFormatFile, strTempPath)
      

  8.   

    CreateTempFile是一个什么函数??
      

  9.   

    '生成文件名
        Private Function CreateTempFile(ByVal strFormatFile As String, ByVal strTempPath As String) As String
            Dim strTempName As String = strTempPath & CInt(Rnd(Now.Millisecond) * 10000000)
            While System.IO.File.Exists(strTempName)
                strTempName = strTempPath & CInt(Rnd(Now.Millisecond) * 10000000)
            End While
            System.IO.File.Copy(strFormatFile, strTempName, True)
            Return strTempName
        End Function