Categories

Category Specific RSS

convert to binary

Public Function CBin(ByVal Nr As Long, Optional Precision As Integer = 8) As String Do Until Nr = 0 CBin = CStr((Nr Mod 2)) + CBin Nr = Nr 2 Loop CBin = Format(Val(CBin), String(Precision, “0”)) End Function

Private Sub Form_Load() MsgBox CBin(88) End Sub

[…]

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInBaiduApp.netBufferDeliciousDiggDiigoWordPressBlogger PostEmailPrintFriendlyShare

bytes to whatever

Function SetBytes(Bytes) As String

On Error GoTo errorhandler

If Bytes >= 1073741824 Then SetBytes = Format(Bytes / 1024 / 1024 / 1024, “#0.00”) _ & ” GB” ElseIf Bytes >= 1048576 Then SetBytes = Format(Bytes / 1024 / 1024, “#0.00″) & ” MB” ElseIf Bytes >= 1024 Then SetBytes = Format(Bytes / 1024, “#0.00″) & […]

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInBaiduApp.netBufferDeliciousDiggDiigoWordPressBlogger PostEmailPrintFriendlyShare

List all printers

Place a combo box on a form and enter the following code.

Private Sub Form_Load() Dim printer For Each printer In Printers Combo1.AddItem printer.DeviceName Next End Sub

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInBaiduApp.netBufferDeliciousDiggDiigoWordPressBlogger PostEmailPrintFriendlyShare

change windows wallpaper

Declare Function SystemParametersInfo Lib “user32” Alias “SystemParametersInfoA” (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long

Public Const SPI_SETDESKWALLPAPER = 20

Dim lngSuccess As Long Dim strBitmapImage As String

strBitmapImage = “h:windowsstraw.bmp” lngSuccess = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, strBitmapImage, 0)

[…]

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInBaiduApp.netBufferDeliciousDiggDiigoWordPressBlogger PostEmailPrintFriendlyShare

change drive name

Private Declare Function SetVolumeLabelA Lib “kernel32” _ (ByVal lpRootPathName As String, _ ByVal lpVolumeName As String) As Long

Public Function SetVolumeName(sDrive As String, n As String) As Boolean Dim i As Long

i = SetVolumeLabelA(sDrive + “:” & Chr$(0), n & Chr$(0))

SetVolumeName = IIf(i = 0, False, True) End Function

[…]

FacebookTwitterGoogle+PinterestTumblrStumbleUponRedditLinkedInBaiduApp.netBufferDeliciousDiggDiigoWordPressBlogger PostEmailPrintFriendlyShare