返回列表 上一主題 發帖

[分享] 取得Excel相關資訊(版本、記憶體...)

[分享] 取得Excel相關資訊(版本、記憶體...)

Sub Excel_Get_info()
    'Excel 版本(代號)
    Select Case Application.VERSION
        Case "5.0": MsgBox "Excel 5.0"
        Case "7.0": MsgBox "Excel 95"
        Case "8.0": MsgBox "Excel 97"
        Case "9.0": MsgBox "Excel 2000"
        Case "10.0": MsgBox "Excel 2002"
        Case "11.0": MsgBox "Excel 2003"
        Case "12.0": MsgBox "Excel 2007"
    End Select
   
    '取得活頁簿的形式 (以Excel2000為例)
    Select Case ThisWorkbook.FileFormat
        Case XlFileFormat.xlExcel5
            MsgBox "這個活頁簿是: Excel95活頁簿"
        Case XlFileFormat.xlExcel7
            MsgBox "這個活頁簿是: Excel97活頁簿"
        Case XlFileFormat.xlWorkbookNormal
            MsgBox "這個活頁簿是: Excel2000活頁簿"
        Case Else
            MsgBox "這個活頁簿是: Excel95/97/2000以外活頁簿"
    End Select
   
    'Excel記憶體
    MsgBox "Microsoft Excel 剩餘記憶體數量" & Application.MemoryFree '(單位為bytes)
    MsgBox "Microsoft Excel 總可用記憶體數量" & Application.MemoryTotal '(單位為bytes)
End Sub

        靜思自在 : 忘功不忘過,忘怨不忘恩。
返回列表 上一主題