- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 257
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-27
|
[Âà¶K] ¨ú±o¨t²Î¸ê°T/¨Ï¥ÎªÌ¸ê°T
¨ú±o¨t²Î¸ê°T/¨Ï¥ÎªÌ¸ê°T
« ©ó: 2005-06-08, 21:20:24 »
--------------------------------------------------------------------------------
1. Excel ª©¥»(¥N¸¹)
Application.Version
2. Windows ª©¥»
Application.OperatingSystem
3. ³Ñ¾l¥i¥Îªº°O¾ÐÅé
Application.MemoryFree (³æ¦ì¬°bytes)
¥t¥~ Application ¦³Ãö°O¾ÐÅ骺ÄÝ©Ê´N¬O
MemoryUsed ©M MemoryTotal¡A¥i¦Û¦æÀ³¥Î¡C
4. Åã¥Ü¾¹ªº¿Ã¹õ¸ÑªR«×
'32-bit API declaration
Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Sub ScreenResolution()
¡@ VidWidth = GetSystemMetrics(SM_CXSCREEN)
¡@ VidHeight = GetSystemMetrics(SM_CYSCREEN)
¡@ MsgBox "¾³~ ¥Ø«e¿Ã¹õ¸ÑªR«×¬O: " & VidWidth & " X " & VidHeight
End Sub
--------------------------------------------------------------------------------
¥H¤U¨Ó¦Û John Walkenbach
For Excel tips, macros, & downloads...
http://j-walk.com/ss
1. ¨ú±o¹q¸£¦WºÙ
Private Declare Function w32_GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetComputerName()
¡@ Dim sComputerName As String
¡@ Dim lComputerNameLen As Long
¡@ Dim lResult As Long
¡@ lComputerNameLen = 256
¡@ sComputerName = Space(lComputerNameLen)
¡@ lResult = w32_GetComputerName(sComputerName, lComputerNameLen)
¡@ If lResult <> 0 Then
¡@¡@¡@ GetComputerName = Left(sComputerName, lComputerNameLen)
¡@ Else
¡@¡@¡@ GetComputerName = "Unknown"
¡@ End If
End Function
2. ¨ú±o¹q¸£¥Ø«eµn¤J¨Ï¥ÎªÌ¦WºÙ
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _
¡@(ByVal lpBuffer As String, nSize As Long) As Long
Function UserName() As String
¡@¡@Dim Buffer As String * 100
¡@¡@Dim BuffLen As Long
¡@¡@BuffLen = 100
¡@¡@GetUserName Buffer, BuffLen
¡@¡@UserName = Left(Buffer, BuffLen - 1)
End Function
--------------------------------------------------------------------------------
¸É¥R¡G
¨ä¹ê¦³¨Ç¨t²Î/¨Ï¥ÎªÌ¸ê°T¥i¥H¥ÑÀô¹ÒÅܼƨú±o¡C
°Ñ¦Ò ¥Î Environ ¨ú±oÀô¹ÒÅܼÆ~ ¤£¬O«DnAPI °Õ
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
leonchou
½×¾ÂºûÅ@¸s
Â÷½u
¤å³¹: 1214
¨ú±o¥»¾÷¸ê°T¸É¥R - Environ / WshNetwork
« ¦^ÂФ峹 #1 ©ó: 2005-09-23, 00:49:13 »
--------------------------------------------------------------------------------
Environ ¤è¦¡¦C¥Ü¦p¤U¡A¥H¨D§¹¾ã¡G
Sub client_info()
MsgBox "¨Ï¥ÎªÌºô°ì" & vbTab & "= " & Environ("UserDomain") & vbLf & _
¡@¡@¡@ "¨Ï¥ÎªÌ©m¦W" & vbTab & "= " & Environ("UserName") & vbLf & _
¡@¡@¡@ "¹q¸£¦WºÙ¡@" & vbTab & "= " & Environ("ComputerName")
'PS. Win 9x ¤£¾A¥Î
End Sub
¥t¦³ WshNetwork ¤è¦¡¡G
Sub client_info()
Dim wsh As Object
Set wsh = CreateObject("WScript.Network")
MsgBox "¨Ï¥ÎªÌºô°ì" & vbTab & "= " & wsh.UserDomain & vbLf & _
¡@¡@¡@¡@¡@"¨Ï¥ÎªÌ©m¦W" & vbTab & "= " & wsh.UserName & vbLf & _
¡@¡@¡@¡@¡@"¹q¸£¦WºÙ¡@" & vbTab & "= " & wsh.ComputerName
Set wsh = Nothing
End Sub
¥DnÀu¯ÊÂI¤ñ¸û --
¨Ï¥Î Environ ªºÀuÂI¬O¤è«K¡A¯ÊÂI«h¬O Win9x ¤£¾A¥Î¡F
©Ò¥Hn¥Îþ¤@ºØ¼gªk´N¬Ý¦U¤H»Ý¨D©M³ß¦n¤F¡C
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
leonchou
½×¾ÂºûÅ@¸s
Â÷½u
¤å³¹: 1214
§Q¥ÎWMI ª«¥ó¨ú±o¨t²Î¸ê°T
« ¦^ÂФ峹 #2 ©ó: 2005-09-23, 01:01:19 »
--------------------------------------------------------------------------------
WMI (Windows Management Instrumentation) §Þ³N¬O·L³n´£¨ÑªºWindows¨t²ÎºÞ²z¤u¨ã¡C³z¹L¦¹¤u¨ã¥i¦b¥»¦a©ÎºÞ²z¥Î¤áºÝ¨t²Î¤¤¨ú±o´X¥G¤@¤Áªº¸ê°T¡C«Ü¦h±M·~ªººô¸ôºÞ²z¤u¨ã³£¬O°ò©óWMI¶}µoªº¡CWMI¦bWin2000/NT¤U¬O¼Ð·Ç¤u¨ã¡A¦bWin9x¤U¬O¿ï¾Ü©Ê¦w¸Ë¿ï¶µ¡C
¥ý¨Ó¬Ý¤@Ó§Q¥ÎWMI¨ú±o¨t²Î¸ê°TªºÂ²³æ½d¨Ò¡A³oÓ½d¨Ò³z¹LWMIª«¥óÀò±o¨t²Î¤¤¹B¦æªºªº¶iµ{¡G
Sub wmi_client_info()
Dim system, itm
Dim i As Integer
i = 1
Set system = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")
For Each itm In system
¡@¡@Cells(1, i) = "¹q¸£¦WºÙ: " & itm.Name
¡@¡@Cells(2, i) = "ª¬ºA: " & itm.Status
¡@¡@Cells(3, i) = "Ãþ«¬: " & itm.SystemType
¡@¡@Cells(4, i) = "¥Í²£¼t®a: " & itm.Manufacturer
¡@¡@Cells(5, i) = "«¬¸¹: " & itm.Model
¡@¡@Cells(6, i) = "°O¾ÐÅé: ~" & itm.totalPhysicalMemory \ 1024000 & "mb"
¡@¡@Cells(7, i) = "°ì(¤u§@¸s²Õ): " & itm.domain
¡@¡@'Cells(7, i) = "¤u§@²Õ" & itm.Workgroup '¤£¤ä´©WorkgroupÄÝ©Ê
¡@¡@Cells(8, i) = "·í«e¥Î¤á: " & itm.UserName
¡@¡@Cells(9, i) = "±Ò°Êª¬ºA: " & itm.BootupState
¡@¡@Cells(10, i) = "¹q¸£ÄÝ©ó: " & itm.PrimaryOwnerName
¡@¡@Cells(11, i) = "¨t²ÎÃþ«¬: " & itm.CreationClassName
¡@¡@Cells(12, i) = "¹q¸£Ãþ«¬: " & itm.Description
¡@¡@'³oùØ°²³]¦w¸Ë¤F¨âÓ§@·~¨t²Î
¡@¡@Cells(13, i) = "±Ò°Ê¿ï¶µ1 :" & itm.SystemStartupOptions(0)
¡@¡@Cells(14, i) = "±Ò°Ê¿ï¶µ2 :" & itm.SystemStartupOptions(1)
¡@¡@i = i + 1
Next
End Sub
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
leonchou
½×¾ÂºûÅ@¸s
Â÷½u
¤å³¹: 1214
§Q¥ÎWMI ª«¥ó¨ú±oºô¸ô¥d¸ê°T
« ¦^ÂФ峹 #3 ©ó: 2005-09-23, 01:14:20 »
--------------------------------------------------------------------------------
²{¦bªº¹q¸£¥H¤Îºô¸ô²Õ¦¨¤Q¤À½ÆÂø¡C¨Ò¦p¨t²ÎµwÅé¤è±´N¦³¥DªO¡BµwºÐ¡Bºô¥d... µ¥µ¥²Õ¥ó¡C
³nÅé¤è±¦³§@·~¨t²Î¡B¨t²Î¤¤¦w¸Ëªº³nÅé¡B¥¿¦b¹B¦æªº¶iµ{µ¥µ¥¡Cºô¸ô¤è±¦³°ì¡B¤u§@¸s²Õµ¥µ¥¡C§Q¥ÎWMI¥i¥H¨ú±o¤W±ªº¥þ³¡¸ê°T¡A¦ý¬O¦pªG¹³¤W±¤@¼Ë§Q¥Î¤À¶µ¨Ó¨ú±oªº¸Ü·|«Ü³Â·Ð¡C¦]¦¹¡AWMI´£¨Ñ¤F¤@ºØÃþ¦üSQL»y¥yªº¬d¸ß»y¥y¡A¥i¥HÂǦ¹Àò±oWMIª«¥ó¤Uªº¤l¶µ¡C
¤U±½d¨Ò¬O·j¯Á¨t²Î¤¤¦w¸Ëªººô¥d¨Ãªð¦^ºô¥d IP ¤Î MAC ¦ì§}¡G
¨ú±o¥»¾÷ºô¥d IP ¦ì§} --
Sub Get_IP()
Dim objWMI As Object
Dim colIP As Object
strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colIP = objWMI.ExecQuery _
¡@("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IP In colIP
¡@If Not IsNull(IP.IPAddress) Then
¡@¡@¡@For i = LBound(IP.IPAddress) To UBound(IP.IPAddress)
¡@¡@¡@¡@MsgBox IP.IPAddress(i), vbInformation, IP.Description(i)
¡@¡@¡@Next
¡@End If
Next
End Sub
¨ú±o¥»¾÷ºô¥d MAC Address (¹êÅé¦ì§}) --
Sub Get_Mac_Addr()
Dim objWMI As Object
Dim colItems As Object
strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration", _
¡@¡@"WQL", wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
¡@MsgBox "MAC Address: " & objItem.MACAddress
Next
End Sub
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
jerrystone
¤p¾Ç¥Í
Â÷½u
¤å³¹: 1
Re: ¨ú±o¨t²Î¸ê°T/¨Ï¥ÎªÌ¸ê°T
« ¦^ÂФ峹 #4 ©ó: 2008-05-29, 12:35:32 »
--------------------------------------------------------------------------------
³o½g¤å³¹¯uªº¶W´Îªº¡A¦ý½Ð°Ý¤@¤U¦bWMI¨ú±o¨t²Î¸ê°TªºÂ²³æ½d¨Ò¨º¤@½g¤å³¹¡A§Ú±Nµ{¦¡co¨ìvb©³¤U¥hrun¡A¦bCellsªº¦a¤è¥¦·|¥X²{"¨S¦³©w¸q³oÓsub©Îfunction"¡A½Ð°Ý§Ú¸Ó¦p¦ó¸Ñ¨M©O¡HÁÂÁÂ!!!
¦VªO¥DÀËÁ| 220.130.36.18 (?)
d8726228
¤¤¾Ç¥Í
Â÷½u
¤å³¹: 11
Re: ¨ú±o¨t²Î¸ê°T/¨Ï¥ÎªÌ¸ê°T
« ¦^ÂФ峹 #5 ©ó: 2008-06-02, 13:59:52 »
--------------------------------------------------------------------------------
¹ê§@¨âºØ§ì¨ú¹q¸£¦WºÙªº¤èªk¬Ò¦¨¥\
¤Q¤À·PÁ¼ӥD´£¨Ñ³o¨Ç¶W¹ê¥Î¸ê°T
¦VªO¥DÀËÁ| 59.125.238.166 (?)
leonchou
½×¾ÂºûÅ@¸s
Â÷½u
¤å³¹: 1214
¨ú±oExcel¨t²Î¸ê°T - ¸É¥R
« ¦^ÂФ峹 #6 ©ó: 2008-11-22, 20:23:12 »
--------------------------------------------------------------------------------
Application.Version ¦^¶ÇÈ»P³q¥Î¦WºÙªº¹ï·Óªí --
ª©¥»¦WºÙ Version¦^¶ÇÈ
Excel 2007¡@ ¡@12.0
Excel 2003¡@ ¡@11.0
Excel 2002¡@ ¡@10.0
Excel 2000¡@ ¡@9.0
Excel 97 ¡@8.0
Excel 95 ¡@7.0
Excel 5.0 ¡@5.0
Application.Version ¦^¶ÇȬ°"¦r¦ê", ½Ð¯d·N.
Y»Ý¶i¤@¨B§PÂ_®É, À³µø¬°¦r¦ê.
¨Ò¦p¥H¤U±NExcelª©¥»¥N¸¹Âର³q¥Îªº¦WºÙ --
µ{¦¡½X:
Select Case Application.Version
¡@Case "5.0":¡@verName = "Excel 5.0"
¡@Case "7.0":¡@verName = "Excel 95"
¡@Case "8.0":¡@verName = "Excel 97"
¡@Case "9.0":¡@verName = "Excel 2000"
¡@Case "10.0": verName = "Excel 2002"
¡@Case "11.0": verName = "Excel 2003"
¡@Case "12.0": verName = "Excel 2007"
End Select
--------------------------------------------------------------------------------
¨ú±o¬¡¶Ã¯ªº§Î¦¡ (¥HExcel2000¬°¨Ò)
µ{¦¡½X:
Select Case ThisWorkbook.FileFormat
¡@Case XlFileFormat.xlExcel5
¡@¡@¡@MsgBox "³oÓ¬¡¶Ã¯¬O: Excel95¬¡¶Ã¯"
¡@Case XlFileFormat.xlExcel7
¡@¡@¡@MsgBox "³oÓ¬¡¶Ã¯¬O: Excel97¬¡¶Ã¯"
¡@Case XlFileFormat.xlWorkbookNormal
¡@¡@¡@MsgBox "³oÓ¬¡¶Ã¯¬O: Excel2000¬¡¶Ã¯"
¡@Case Else
¡@¡@¡@MsgBox "³oÓ¬¡¶Ã¯¬O: Excel95/97/2000¥H¥~¬¡¶Ã¯"
End Select
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
leonchou
½×¾ÂºûÅ@¸s
Â÷½u
¤å³¹: 1214
¨ú±oVBAª©¥»/§@·~¨t²Îª©¥» by WMI
« ¦^ÂФ峹 #7 ©ó: 2008-11-22, 20:29:29 »
--------------------------------------------------------------------------------
¨ú±oVBAª©¥» by WMI
°Ñ¦Òºô§} - Microsoft§Þ³N¤å¥ó
µ{¦¡½X:
Dim WMIServ As Object, objList As Object
basePath = Environ("ProgramFiles") & "\Common Files\Microsoft Shared\VBA"
filePath = Array(basePath, basePath & "\VBA6")
Filename = Array("vbe.dll", "vbe6.dll")
Set WMIServ = GetObject("winmgmts:\\.\root\cimv2")
For i = LBound(filePath) To UBound(filePath)
¡@¡@Set objList = WMIServ.ExecQuery _
¡@¡@¡@¡@("ASSOCIATORS OF {Win32_Directory.Name='" & filePath(i) & _
¡@¡@¡@¡@¡@¡@"'} Where " & "ResultClass = CIM_DataFile")
¡@¡@On Error Resume Next
¡@¡@For Each f In objList
¡@¡@¡@¡@'If f.Extension = "dll" Then
¡@¡@¡@¡@If Mid(f.Name, InStrRev(f.Name, "\") + 1) = Filename(i) Then
¡@¡@¡@¡@¡@¡@MsgBox "±zªºVBAª©¥»¬O: " & f.Version
¡@¡@¡@¡@¡@¡@Exit For
¡@¡@¡@¡@End If
¡@¡@Next
Next
Set objList = Nothing: Set WMIServ = Nothing
--------------------------------------------------------------------------------
¨ú±o§¹¾ãªº§@·~¨t²Îª©¥»¦WºÙ by WMI
¿é¥X½d¨Ò: Windows 2000 Professional (5.0.2195)
µ{¦¡½X:
Dim Locator, Service, objList, msg As String
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Set Service = Locator.ConnectServer
Set objList = Service.ExecQuery("Select * From Win32_OperatingSystem")
For Each os In objList
¡@¡@msg = msg & os.Caption & vbCrLf
¡@¡@msg = msg & os.Version
Next os
MsgBox "±zªºOSª©¥»¬O: " & msg, vbInformation
Set Service = Nothing
Set objList = Nothing
Set Locator = Nothing
« ³Ì«á½s¿è®É¶¡: 2008-11-22, 20:33:02 ¥Ñ leonchou » ¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW...
xmi
¤¤¾Ç¥Í
Â÷½u
¤å³¹: 42
Re: §Q¥ÎWMI ª«¥ó¨ú±o¨t²Î¸ê°T
« ¦^ÂФ峹 #8 ©ó: 2008-11-23, 19:14:54 »
--------------------------------------------------------------------------------
¤Þ¥Î¦Û: leonchou ©ó 2005-09-23, 01:01:19
WMI (Windows Management Instrumentation) §Þ³N¬O·L³n´£¨ÑªºWindows¨t²ÎºÞ²z¤u¨ã¡C³z¹L¦¹¤u¨ã¥i¦b¥»¦a©ÎºÞ²z¥Î¤áºÝ¨t²Î¤¤¨ú±o´X¥G¤@¤Áªº¸ê°T¡C«Ü¦h±M·~ªººô¸ôºÞ²z¤u¨ã³£¬O°ò©óWMI¶}µoªº¡CWMI¦bWin2000/NT¤U¬O¼Ð·Ç¤u¨ã¡A¦bWin9x¤U¬O¿ï¾Ü©Ê¦w¸Ë¿ï¶µ¡C
¥ý¨Ó¬Ý¤@Ó§Q¥ÎWMI¨ú±o¨t²Î¸ê°TªºÂ²³æ½d¨Ò¡A³oÓ½d¨Ò³z¹LWMIª«¥óÀò±o¨t²Î¤¤¹B¦æªºªº¶iµ{¡G
Sub wmi_client_info()
Dim system, itm
Dim i As Integer
i = 1
Set system = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")
For Each itm In system
¡@¡@Cells(1, i) = "¹q¸£¦WºÙ: " & itm.Name
¡@¡@Cells(2, i) = "ª¬ºA: " & itm.Status
¡@¡@Cells(3, i) = "Ãþ«¬: " & itm.SystemType
¡@¡@Cells(4, i) = "¥Í²£¼t®a: " & itm.Manufacturer
¡@¡@Cells(5, i) = "«¬¸¹: " & itm.Model
¡@¡@Cells(6, i) = "°O¾ÐÅé: ~" & itm.totalPhysicalMemory \ 1024000 & "mb"
¡@¡@Cells(7, i) = "°ì(¤u§@¸s²Õ): " & itm.domain
¡@¡@'Cells(7, i) = "¤u§@²Õ" & itm.Workgroup '¤£¤ä´©WorkgroupÄÝ©Ê
¡@¡@Cells(8, i) = "·í«e¥Î¤á: " & itm.UserName
¡@¡@Cells(9, i) = "±Ò°Êª¬ºA: " & itm.BootupState
¡@¡@Cells(10, i) = "¹q¸£ÄÝ©ó: " & itm.PrimaryOwnerName
¡@¡@Cells(11, i) = "¨t²ÎÃþ«¬: " & itm.CreationClassName
¡@¡@Cells(12, i) = "¹q¸£Ãþ«¬: " & itm.Description
¡@¡@'³oùØ°²³]¦w¸Ë¤F¨âÓ§@·~¨t²Î
¡@¡@Cells(13, i) = "±Ò°Ê¿ï¶µ1 :" & itm.SystemStartupOptions(0)
¡@¡@Cells(14, i) = "±Ò°Ê¿ï¶µ2 :" & itm.SystemStartupOptions(1)
¡@¡@i = i + 1
Next
End Sub
¬°¤°»ò§Ú·|°±¦b -->¡@¡@ Cells(6, i) = "°O¾ÐÅé: ~" & itm.totalPhysicalMemory \ 1024000 & "mb"¡@¡@
§Ú¬O¥Îoffice2007ªº
¦VªO¥DÀËÁ| 221.127.110.228 (?)
leonchou
½×¾ÂºûÅ@¸s
Â÷½u
¤å³¹: 1214
Re: §Q¥ÎWMI ª«¥ó¨ú±o¨t²Î¸ê°T
« ¦^ÂФ峹 #9 ©ó: 2008-11-24, 00:22:56 »
--------------------------------------------------------------------------------
¤Þ¥Î¦Û: xmi ©ó 2008-11-23, 19:14:54
¬°¤°»ò§Ú·|°±¦b -->¡@¡@ Cells(6, i) = "°O¾ÐÅé: ~" & itm.totalPhysicalMemory \ 1024000 & "mb"¡@¡@
§Ú¬O¥Îoffice2007ªº
¦bExcel2000+Windows2000 sp2´ú¸Õ¥¿±`¡C
§Aªº¿ù»~°T®§¬OÔ£¡H§@·~¨t²Îªºª©¥»¡H
§Ú·Q¥i¯à¬OVBA©ÎOS¤£¦P¡AWMIª«¥óÄݩʤ]¤£ºÉ¬Û¦PªºÃö«Y...
½Ð©M§A¬Û¦PÀô¹ÒªºªB¤Í¸Õ¤@¤U¡C
¦VªO¥DÀËÁ| 203.79.168.37 (?)
--------------------------------------------------------------------------------
BEFORE ASKING, YOU SHOULD RTFH, RTFM, STFW... |
|