32 to 64 bit conversion
#If Win64 Then
Private Declare PtrSafe Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare PtrSafe Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
#Else
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
#End If
Get System User Details
Sub GetSystemInfo()
MsgBox "User Name: " & Environ("USERNAME") & vbCrLf & _
"Computer Name: " & Environ("COMPUTERNAME")
End Sub
System Date & Time
Sub SystemDateTime()
MsgBox "Today: " & Date & vbCrLf & "Time: " & Time
End Sub
Check If Folder Exists
Sub CheckFolder()
If Dir("C:\TestFolder\", vbDirectory) <> "" Then
MsgBox "Folder Found"
Else
MsgBox "Folder Missing"
End If
End Sub
Create Folder Programmatically
Sub CreateFolder()
MkDir "C:\TestFolder"
End Sub
Open Any Website From VBA
Sub OpenWebsite()
Shell "cmd /c start https://www.google.com", vbHide
End Sub
Detect Office Version Installed
Sub OfficeVersion()
MsgBox "Office Version: " & Application.Version
End Sub
Run External EXE from VBA
Sub RunNotepad()
Shell "notepad.exe", vbNormalFocus
End Sub
Get Screen Resolution
Declare PtrSafe Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
Sub ScreenOutput()
MsgBox "Width: " & GetSystemMetrics(0) & vbCrLf & _
"Height: " & GetSystemMetrics(1)
End Sub
Check If User Is Admin (Windows Group)
Sub CheckAdmin()
If Environ("USERDOMAIN") <> "" Then
MsgBox "Possibly an Admin User!"
Else
MsgBox "Standard User"
End If
End Sub
Play Windows Beep Sound
Sub BeepSound()
Beep
End Sub
SystemInfo Command Dump
संपूर्ण OS details को text file में download करें।
Sub GetFullSystemInfo()
Shell "cmd.exe /c systeminfo > C:\SysInfo.txt", vbHide
MsgBox "System info saved to C:\SysInfo.txt"
End Sub
System Monitor Trick
Sub RunningProcesses()
Shell "cmd.exe /c tasklist > C:\Processes.txt", vbHide
MsgBox "Saved at C:\Processes.txt"
End Sub


0 टिप्पणियाँ
Please do not enter any spam link in the comment box.