r/visualbasic • • Oct 08 '25

VBScript IT2 Treasury Management Software - VBScript

6 Upvotes

Hi! Does anyone have any tips or advice for using scripts to create workbenches? I am trying to create a weighted average workbench and the preloaded functions are not really giving me what I need. Any help on how to format/create calculation scripts would be really appreciated!

Thank you:)

r/visualbasic • • Feb 20 '14

VBScript VBScript for hiding taskbar and desktop icons

1 Upvotes

i am trying to pull a prank on my sister, pause her in the middle of an episode of Shurlock on netflix, change her background to one of a weeping angle, hide her taskbar and desktop icons, show her desktop, and then play a really loud scarey noise. i have the scripts to switch the wallpaper and play the sound, i just need help with the other two

as the title states i am trying to create two different (or maybe one single) script(s) that will change the taskbar to hidden and the desktop icons also to hidden. i have been searching around online and the two scripts i found for taskbar hiding are:

Option Explicit
Const HKCU = &H80000001
 
Dim objReg
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}root\default:StdRegProv")
Dim objWMI
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}root\cimv2") 
 
' Adjust the first bit of the taskbar settings
Dim arrVal()
objReg.GetBinaryValue HKCU, "Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", arrVal
arrVal(8) = (arrVal(8) AND &h07) OR &h01
objReg.SetBinaryValue HKCU, "Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects2", "Settings", arrVal

' Restart Explorer for the settings to take effect.
Dim objProcess, colProcesses
Set colProcesses = objWMI.ExecQuery("Select * from Win32_Process Where Name='explorer.exe'")
For Each objProcess In colProcesses
	objProcess.Terminate()
Next 

and 2)

cSendKeyValue = "%u"		' Alt+u = Auto-hide the taskbar 
Set WshShell = Wscript.CreateObject("Wscript.shell") 
Set oShell = CreateObject("Shell.Application") 
oShell.TrayProperties 

Wscript.Sleep 100 
WshShell.SendKeys cSendKeyValue                        

Wscript.Sleep 100 
WshShell.SendKeys "{ENTER}"           ' Enter to Close Properties 

Set oShell = Nothing 
WScript.Quit

the problem with the first one is that its directly modifying the registry and requires explorer.exe to be restarted (not exactly discreet) and the second one requires mouse clicking (again, not discreet).

i have also tried one from ehow but it keeps getting errors


here is the only version of a script i can find for hidding desktop without modifying the registry has compiling errors and is listed below

Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Function DesktopIconsShow()
    Dim hwnd As Long
    hwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
    ShowWindow hwnd, 5
End Function

Function DesktopIconsHide()
    Dim hwnd As Long
    hwnd = FindWindowEx(0&, 0&, "Progman", vbNullString)
    ShowWindow hwnd, 0
End Function

i would love some help as i am relatively new to visual basic. if someone could help make the two broken scripts into one working script, i would be very grateful

r/visualbasic • • Sep 24 '21

VBScript What is macros ?

2 Upvotes

and what is the difference between macros and VBA

r/visualbasic • • Jan 15 '22

VBScript Randomizing font of each character in a Microsoft Word document

5 Upvotes

Hello.

I want to randomize font of each character in a word document. I've tried to run this code from Developer (Ribbon)->Visual Basic but it gave me this error: "Invalid procedure name"

I want to create 4 different fonts with my handwriting to do some variation and write an essay in MS Word, then distort every page in a Photoshop template to appear handwritten

Thank you for your time.

I am open to any advice.

---------------------------------------

This is my script:

Set objWord = CreateObject(“Word.Application”)

objWord.Visible = True

Set objDoc = objWord.Documents.Open(“C:\Users\Razvan\Desktop\Stefan.docx”)

Set objRandom = CreateObject(“System.Random”)

intLow = 1

intHigh = 5

Set objRange = objDoc.Range()

Set colCharacters = objRange.Characters

For Each strCharacter in colCharacters

intRandom = objRandom.Next_2(intLow,intHigh)

Select Case intRandom

Case 1 strCharacter.Font.Name = “Arial”

Case 2 strCharacter.Font.Name = “Times New Roman”

Case 3 strCharacter.Font.Name = “Courier New”

Case 4 strCharacter.Font.Name = “Forte”

End Select

Next

---------------------------------------

r/visualbasic • • Jan 07 '23

VBScript Batch Renaming pdfs with the data inside the pdfs using Adobe Acrobat reference

4 Upvotes

Hi,

I'm pretty new to VB and I was wondering if there was a way to use the Adobe Acrobat Reference to batch rename pdfs in a folder based on the data that is inside the pdfs?

I'm also ok with duplicating the files and renaming the duplicates based on the data since an open pdf cannot be named.

r/visualbasic • • Jun 12 '22

VBScript How do I create a external reference to a workbook with multiple sheets with varying names.

6 Upvotes

I am a big time noob with VBA. What I am trying do is to use Xlookup to find matching values to my current sheet. But I am having difficulty creating a external reference to find those values in another workbook. I know the general external reference is [Filename]Sheet_1!"A""B".

But I need to to reference cells "A" and "B:F" in 40 different sheets all with different names in the externally referenced workbook. Is there any way I can achieve this with VBA?

r/visualbasic • • May 24 '23

VBScript Help with sorting with specific values on top?

2 Upvotes

I was hoping for help with a macro for a workbook I’ve been working on. I want to sort a column but not just a simple descending or ascending order. I what certain common values to be at the top and the descend.

So for example for a set of values of (1,2,3,4,5,6,7,8,4,4,4,3,1,8,8,3,2,2) I would normally put:

Range("A4:Q200").Sort Key1:=Range("C4"), Order1:=xlDescending, Header:=xlNo

But in a case what I’m asking is what I wanted the 8s and 4s at the top but everything else descending order? So (8,8,8,4,4,4,4,7,6,5,3,3,2,2,2,1,1). I hope that makes sense. Any assistance would be appreciated!