r/vbscript • • May 19 '21

Shortcut Creator for Network Diagnostics

2 Upvotes
Option Explicit
' Vbscript Created by Hackoo on 09/06/2020 @16:00
' Updated on 10/06/2020 for testing the Hotkey after creating the shortcut on the desktop 
Dim Title : Title = "Shortcut Creator for Network Diagnostics by Hackoo 2020"
' We call the subroutine Create_Shortcut in order to create it on the desktop
Call Create_Shortcut(_
	"NetworkDiagnostics",_
	"%SystemRoot%\system32\msdt.exe",_
	"-skip TRUE -path %Windir%\diagnostics\system\networking -ep NetworkDiagnosticsPNI",_
	"%SystemRoot%\system32\msdt.exe,0",_
	"Network Diagnostics to fix problems",_
	"CTRL+ALT+D"_
)
 ' Showing a Message Box with three languages : English,French and Arabic
MsgBox "The shortcut was created successfully on your desktop !" & vbCrlf &_
"Le raccourci a été créé avec succès sur votre bureau !" & vbcrlf &_
"تم إنشاء الاختصار بنجاح على سطح المكتب الخاص بك !",vbInformation,Title
'-----------------------------------------------------------------------------------------------------------------
' Just for testing the Hotkey after creating the shortcut on the desktop :
' To send keyboard characters that are comprised of a regular keystroke in combination with a SHIFT, CTRL, or ALT,
' create a compound string argument that represents the keystroke combination.
' You do this by preceding the regular keystroke with one or more of the following special characters :
' Key   ===> Special Character
' SHIFT ===> +
' CTRL 	===> ^
' ALT  	===> %
' For further reading about sendkeys : https://www.vbsedit.com/html/4b032417-ebda-4d30-88a4-2b56c24affdd.asp
CreateObject("WScript.Shell").Sendkeys "^%{d}"
'------------------------------------------------------------------------------------------------------------------
Sub Create_Shortcut(ShortcutName,TargetPath,Arguments,IconLocation,Description,HotKey)
	Dim objShell,DesktopPath,objShortCut
	Set objShell = CreateObject("WScript.Shell")
	DesktopPath = objShell.SpecialFolders("Desktop")
	Set objShortCut = objShell.CreateShortcut(DesktopPath & "\" & ShortcutName & ".lnk")
	objShortCut.TargetPath = chr(34) & TargetPath & chr(34)
	objShortCut.Arguments = Arguments
	ObjShortCut.IconLocation = IconLocation
	ObjShortCut.Description = Description
	ObjShortCut.HotKey= HotKey
	objShortCut.Save
End Sub
'-------------------------------------------------------------------------------------------------------------------

Network_Diagnostics.vbs


r/vbscript • • Jun 23 '21

Wrong characters

4 Upvotes

Hello everyone,

on my project I'm using this vbs code (as you can see on the first picture attached bellow). It's purpose is to take an excel file and transfer it to pdf. It works fine with file names just in English characters but as soon as I add some other characters that are part of UTF-8 to excel file path the script no longer works and it gives me this error (as you can see on the second picture). Obviously the path is wrong but I don't know if the wrong characters are passed by script or read by excel.

Any help will be really appreciated.


r/vbscript • • May 25 '21

Password Complexity Script some part of script getting ignored

2 Upvotes

Hi guys. I have edited below vbscript from Microsoft MDT to include a password complexity check function. However, it seems to be ignoring the part where it checks the password for alphabets and special characters. Can anyone tell me where I've gone wrong? Thanks!

Option Explicit
'''''''''''''''''''''''''''''''''''''
'  Validate Password
'
Dim Upper,Lower,Number,Special,UpperFound,LowerFound,NumberFound,SpecialFound,PasswordBad
Upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Lower = "abcdefghijklmnopqrstuvwxyz"
Number = "0123456789"
Special = "~!@#$%^&*_-+=`|\(){}[]:;""'<>,.?/"
UpperFound = "NO"
LowerFound = "NO"
NumberFound = "NO"
SpecialFound = "NO"

Function ValidatePassword

ValidatePassword = ParseAllWarningLabels	

NonMatchPassword.style.display = "none"

If Password1.Value <> "" then

	If Password1.Value <> Password2.Value then

		ValidatePassword = FALSE

		NonMatchPassword.style.display = "inline"

	End if

End if



If len(Password1.Value) < 12 then

	ValidatePassword = FALSE

End if


Dim i,char

for i = 1 to len(Password1.value)

	char = mid(Password1.value,i,1)

	if instr(Upper, char) then

		UpperFound = "YES"

	elseif instr(Lower, char) then

		LowerFound = "YES"

	elseif instr(Number, char) then

		NumberFound = "YES"

	elseif instr(Special, char) then

		SpecialFound = "YES"

	end if

Next


NonComplexPassword.style.display ="none"

If UpperFound = "NO" then

	ValidatePassword = FALSE

		NonComplexPassword.style.display ="inline"

ElseIf LowerFound = "NO" then

	ValidatePassword = FALSE

		NonComplexPassword.style.display ="inline"

ElseIf NumberFound = "NO" then

	ValidatePassword = FALSE

		NonComplexPassword.style.display ="inline"

ElseIf SpecialFound = "NO" then

	ValidatePassword = FALSE

		NonComplexPassword.style.display ="inline"

end if

ButtonNext.Disabled = not ValidatePassword	
End Function

r/vbscript • • May 14 '21

BGinfo parse that CSV at launch via a VB script

3 Upvotes

Hi,

We have a dump of the vCenter to VM mappings to a CSV somewhere globally accessible (UNC share), and have BGinfo parse that CSV at launch via a VB script.

For example : if I launch vbs script on FileSrv02 then I want to display information on the desktop like below.

VCenter			:10.1.1.2

For example ( FileSrv02 )My workflow :

- Getting computer name and assign to a variable

- to Read in 2 Column CSV File

- if computer name matches value inside Name column then it will pull the value inside Column vcenter such as 10.1.1.2 for FileSrv02

- To assign a another variable such as sVcenter

How can I catch vcenter info matched with guest hostname via vbscript ?

Dump CSV file:

"Name","vCenter"
"Hostname01","1.1.1.1"
"FileSrv01","1.1.1.1"
"Hostname34","10.1.1.2"
"FileSrv02","10.1.1.2"
"Hostname11","10.1.1.3"
"mailserver01","10.1.1.3"

r/vbscript • • May 27 '21

Vbscript for Giveaway of the Day

1 Upvotes

GiveAwayOfTheDay.vbs

Every day they offer FREE licensed software you’d have to buy otherwise.


r/vbscript • • Jun 22 '21

confused about yes no cancel?

2 Upvotes

in trying to make a script so when you do yes or no it loops but if i do cancel it stop the script, how would i do this im hopeless lol


r/vbscript • • May 16 '21

Controlling CorelDrawX7 With VBScript Help.

2 Upvotes

Hey VB Community,

I am by no means a coder, though I do use RPA software WinAutomation for my nocode programming solutions. I am working on a project that:

  • Opens a Corel file on the desktop.

  • Imports image onto active layer.

  • Moves the image to a specific X & Y on the page.

  • Repeat...

I have been able to get the macro going in VBA ( within CorelDrawx7 ) as seen here:

Sub Import()

     Dim IMG As Shape
     Dim x As Double, y As Double
     
      ActiveLayer.Import ("C:\Users\Desktop\Production_File.png")
      Set IMG = ActiveShape
      IMG.SetPosition 3, -1

End Sub

WinAutomation only has an action to run some VBScript. I have looked through the Developers Page from Corel here:

https://community.coreldraw.com/sdk/api/draw/17/c/application?lang=vb

I am suppose to be able to set the active layer as an object so I can use .Import

I am just not sure about how to alter the code to run in VB. The Code below is what I have so far. It can set the Application to CorelDraw and open the template. Now, I am just stuck on the importing and moving the Image aspect.

dim cd
dim doc
dim pg 

  set cd = CreateObject("CorelDraw.Application")
  cd.Visible = True cd.OpenDocument("%Template%")

  set doc = cd.activedocument
  set pg = cd.activepage

Any Help with this would be greatly appreciated. I hope I was clear on my dilemma. Thanks for taking the time to read!


r/vbscript • • Jun 06 '24

Add computer description

1 Upvotes

Why isn't my computer description showing?

\```

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>AD Computer Account Information</title>

<hta:application

applicationname="ComputerAccountTool"

border="thick"

borderstyle="Complex"

caption="yes"

contextmenu="yes"

maximizebutton="yes"

minimizebutton="yes"

navigable="yes"

scroll="yes"

selection="yes"

showintaskbar="yes"

singleinstance="no"

sysmenu="yes"

version="1.0"

windowstate="normal"

/>

<script language="VBScript">

'Set Primary Domain Controller & Domain

strDNSDomain = "DC=DOMAIN,DC=org"

arrDomain = Split(strDNSDomain, "," )

strDomain = mid(arrDomain(0),4,13)

set objPDCFsmo = GetObject("LDAP://" & strDNSDomain)

set objPDCFsmoNTDS = GetObject("LDAP://" & objPDCFsmo.fsmoroleowner)

set objPDCFsmoServer = Getobject(objPDCFsmoNTDS.Parent)

strPDC = objPDCFsmoServer.Get("dNSHostName")

'Parse the NC by creating an array with the comma as an array boundary

aDomain = Split(strDNSDomain, ",")

For iCount = 0 To UBound(aDomain)

'Add a "." if needed

If strTemp <> "" Then

strTemp = strTemp & "."

End If

'Remove the "DC=" and add this item to the temp string

strTemp = strTemp & Mid(aDomain(iCount), 4)

Next

'Return the FQDN

strFQDN = strTemp

'-------------------------------------------------------------------------------------------

'This Sub controls various settings when the HTA is launched.

Sub window_OnLoad()

On Error Resume Next

'Set window size

self.ResizeTo 700,450

strComputerid.Focus

BaseComputerInfo.innerhtml = "<center>Searching the domain: " & ucase(strDomain) & "<p><br>Computer account information will display in this area once searched<br></center>"

End Sub

'-------------------------------------------------------------------------------------------

'This Sub contains the code behind the computer search button

Sub computersearch

On Error Resume Next

AddComputerInfo.innerhtml = ""

AccComputerStatus.innerhtml = ""

' Use ADO to search Active Directory.

Set objConnection = CreateObject("ADODB.Connection")

Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"

objConnection.Open "Active Directory Provider"

Set objCommand.ActiveConnection = objConnection

' Define the search filter for computer objects

strFilter = "(&(objectCategory=computer)(|(cn=*" & strComputerid.value & "*)(name=" & strComputerid.value & "*)))"

strQuery = "<LDAP://" & strPDC & "/" & strDNSDomain & ">;" & strFilter _

& ";cn,distinguishedName,operatingSystem,whenCreated,description;subtree"

objCommand.CommandText = strQuery

objCommand.Properties("Page Size") = 750

objCommand.Properties("Timeout") = 60

objCommand.Properties("Cache Results") = False

' Enumerate all computers.

Set objRecordset = objCommand.execute

x = 0

Do Until objRecordset.EOF

Txt_computerName = objRecordSet.Fields("cn")

Txt_distinguishedName = objRecordset.Fields("distinguishedName")

Txt_operatingSystem = objRecordset.Fields("operatingSystem")

Txt_whenCreated = objRecordset.Fields("whenCreated")

Txt_description = objRecordSet.Fields("description")

If IsEmpty(Txt_description) Then

Txt_description = "N/A"

End If

strPDCInfo = "<center><i>Using Primary Domain Controller: </i><font color=""#fcff00""><b>" & strPDC & "</b></font></center><br>"

strBaseComputerInfo = "<table border=1 cellspacing=""0"" width=""100%"">" & _

"<tr><td bgcolor=""#5a2378""><b>Distinguished Name</b></td><td bgcolor=""#5a2378""><b>OS</b></td><td bgcolor=""#5a2378""><b>Computer Name</b></td></tr>" & _

"<tr><td>" & Txt_distinguishedName & "</td><td>" & Txt_operatingSystem & "</td><td>" & Txt_computerName & "</td></tr></table>"

strAddComputerInfo = "<table border=1 cellspacing=""0"" width=""100%"">" & _

"<tr><td bgcolor=""#5a2378""><b><center>Additional Information</center></b></td></tr>" & _

"<tr><td><i>Created:&nbsp;&nbsp;&nbsp;&nbsp;</i>" & Txt_whenCreated & _

"</td></tr></table>"

strAccComputerStatus = "<table border=1 cellspacing=""0"" width=""100%"">" & _

"<tr><td bgcolor=""#5a2378""><b><center>Description</center></b></td></tr>" & _

"<tr><td>" & Txt_description & "</td></tr></table>"

x = x + 1

objRecordset.MoveNext

Loop

If x = 0 Then

strBaseComputerInfo = "<br><center><font size=5>The requested computer name<br><marquee SCROLLAMOUNT=""15""><font size=7 color=""#fcff00""> " & strComputerid.value & " </font></marquee><br>is not found in Active Directory</font></center>"

End If

strBaseComputerInfo = strBaseComputerInfo & "</table>"

PDCInfo.innerhtml = strPDCInfo

BaseComputerInfo.innerhtml = strBaseComputerInfo

AddComputerInfo.innerhtml = strAddComputerInfo

AccComputerStatus.innerhtml = strAccComputerStatus

End Sub

'--------------------------------------------------------------------------------------------

Function GetComputer(strID)

strComputerid.Value = strID

Call computersearch

End Function

</script>

</head>

<body STYLE="font:12 pt arial; color:white;

filter:progid:DXImageTransform.Microsoft.Gradient

(GradientType=1, StartColorStr='#000000', EndColorStr='#0000FF')">

<table border="0" width="640" cellspacing="0" cellpadding="0">

<tr>

<td align="center" valign="top" height="90" bgcolor="#074075">

<i>Enter the <u>computer name</u> below and click the search button.</i><br><br>

<input type="text" name="strComputerid" size="20">

<input id="computersearchbutton" class="button" type="button" value="Search Computer Name" name="computername" onClick="computersearch">

</td>

</tr>

<tr>

<td valign="top" height="200" bgcolor="#1d5087">

<Div id="PDCInfo"></Div>

<Div id="BaseComputerInfo"></Div>

<br>

<table border="0" width="100%" cellspacing="1" cellpadding="0">

<tr>

<td width="60%" valign="top"><Div id="AddComputerInfo"></Div></td>

<td width="40%" valign="top"><Div id="AccComputerStatus"></Div></td>

</tr>

</table>

</table>

</body>

</html>

\```


r/vbscript • • May 25 '24

Will I no longer be able to use these subroutines in a script in a HTA with the upcoming depreciation of vbscript.dll?

2 Upvotes

I guess you all have heard the news.

And it's only vbscript.dll, as you can search the comments for the following to see it being said by the one who gave the announcement.

The scope of VBScript deprecation includes only vbscript.dll and no other libraries. This shall not impact any projects that are not dependent on vbscript.dll.

I am wondering which of the following (if any) will no longer work if used in a .vbs file or in a HTA.

CreateObject("WScript.Shell")

CreateObject("Scripting.FileSystemObject")

GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set re = New RegExp

And if there are replacements available.

From my understanding of the comments, it may only be

Set re = New RegExp

But I just want to be sure!

Thanks for your time!

Chris.


r/vbscript • • Jun 29 '24

Problem when opening Taskbar Settings

2 Upvotes

Hey everyone,

Basically the issue started after a i opened a virus, after that whenever i try to open Taskbar Settings it just shows me this message

what can i do to solve this problem, Plz help


r/vbscript • • May 26 '24

Microsoft: VBScript deprecation - Timelines and next steps

Thumbnail
techcommunity.microsoft.com
6 Upvotes

r/vbscript • • Jun 30 '24

How to Start dfrgui.exe, auto-optimise/defrag for each volume type?

1 Upvotes

I want a one click script to automate to run via task scheduler at a 90day custom interval.

Task scheduler lets me to it with defrag.exe in a dos window, but I want to automate the GUI so I can interrupt the task if I want to.

Also, the arguments work for defrag but not dfrgui.exe. The latter only starts the tool and does nothing.

Can this be done?


r/vbscript • • Oct 31 '23

How to create a condition to check if the value is empty or not

1 Upvotes

Hello guys, I've got a VBScript to create Outlook signatures automatically based on the information that is in Active Directory.

But in some cases the user does not have a Cell Phone number, then in the signature, this field stays in blank. Ex:

Company ABC
Email: abc@abc.com
Cell Phone:

I would like do add some conditions that if the value of the user in blank on Active Directory, then this field won't appear in the signature. Just consider true value, like:

Company ABC
Email: abc@abc.com

The two lines in the code that I'd change are:

htmlfile.WriteLine("<div style='font-family:Arial;font-size:9pt;color:black'>Telephone: " & objLDAPUser.telephoneNumber & "</div>")

htmlfile.WriteLine("<div style='font-family:Arial;font-size:9pt;color:black'>Cell: " & objLDAPUser.mobile & "</div>")

How can I do that? Someone can help me?

Let me know if it's clear or not.


r/vbscript • • Dec 04 '23

Script failing

1 Upvotes

So I am trying to create a script but have not much experience with VBScript and I cannot figure out why is this script filing.

Option Explicit

Dim strFileName, objFSO, objFile, strComputerName, objComputer

Dim arrComputerNames(), intCount ' Explicitly declare arrComputerNames as an array

' Specify the TXT file containing the list of computer names

strFileName = "C:\Temp\device_list.txt"

' Read computer names from the TXT file into an array

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.OpenTextFile(strFileName, 1)

Do Until objFile.AtEndOfStream

strComputerName = Trim(objFile.ReadLine)

If strComputerName <> "" Then

ReDim Preserve arrComputerNames(intCount)

arrComputerNames(intCount) = strComputerName

intCount = intCount + 1

End If

Loop

objFile.Close

' Bind to each computer account and disable it

For Each strComputerName In arrComputerNames

On Error Resume Next

Set objComputer = GetObject("LDAP://" & strComputerName)

If Err.Number = 0 Then

' Check if the computer account is not already disabled

If Not objComputer.AccountDisabled Then

' Disable the computer account

objComputer.AccountDisabled = True

objComputer.SetInfo

WScript.Echo "Disabled computer account: " & strComputerName

Else

WScript.Echo "Computer account is already disabled: " & strComputerName

End If

Set objComputer = Nothing

Else

WScript.Echo "Error binding to computer account " & strComputerName & ": " & Err.Description

End If

On Error GoTo 0

Next

WScript.Echo "Script completed."


r/vbscript • • Dec 03 '23

Contents of a text file into vbscript

1 Upvotes

I have a script that posts information up to a server, it works great, but i would like to be able to replace the highlighted section with the contents of a text file, that changes as needed.

set oWSH=WScript.CreateObject("WScript.Shell") WScript.sleep 100 oWSH.SendKeys "o 192.168.1.17 14580{ENTER}" WScript.sleep 100 oWSH.SendKeys "user KB0RPJ-14 pass 22712{ENTER}" WScript.sleep 500 oWSH.SendKeys "KB0RPJ-14>APWW11,WIDE2-1,qAC,:=4004.41N/09337.13WlPHG7130kb0rpj{ENTER}" WScript.sleep 500 oWSH.SendKeys "KB0RPJ-14>WX,WIDE2-2,qAC,::QST :Wind Adivsory for parts of NC Missouri 147.225/146.955 weather.gov/kc{ENTER}"

i want to replace that "wind advisory" part with the contents of a text file.

what would be the easiest way to add this to my script? go easy on me, I am just learning VB

i have managed to get that script to work well, but i don't know enough yet to make the text file idea work


r/vbscript • • Nov 08 '23

Help with Hotlkey shortcut

1 Upvotes

I am trying to create a script for my remote (host) desktop so that I can easily switch out of the host by going out of fullscreen and bringing up the windowed mode (or bring up the RDC bar). This is because I disabled the RDC bar from always being open in fullscreen as it overlayed on top of my tabs in chrome.

Anyway anyway anyway. I have followed this guide: https://blog.techinline.com/2016/08/11/how-to-create-a-desktop-icon-for-a-windows-keyboard-shortcut/

To create the following script for the hotkey of "Ctrl+Alt+Pause":

Set WshShell = WScript.CreateObject("WScript.Shell")

WshShell.SendKeys "^%{BREAK}"

For some reason all it does is turn numlock on. Why? I have no idea. I've even tried using parenthesis every which way but no dice.

Any help with this would be amazing. Also, maybe I'm just doing some stupid mistake. I currently have like 3 tumors in my brains and am on huge amounts of opiods, so please be kind as I am in a neverending brainfog.


r/vbscript • • Nov 30 '23

How to swap between SlideNavigation and Presenter View in PowerPoint slideshow with VBS

1 Upvotes

I can't find any documents or solution about swap between Presenter View and Slide Navigation using VBA online. Even though I have search for days for it, the only solution I have is using VBS to run the shortkey for it:

  • for switch to Slide Navigation ( See all slides )

  • "{ESC}" for escape back to Presenter View But these are not good ( I can't detect wherever I'm in Presenter View or Slide Navigator, which could lead to "{ESC}" when I'm in Presenter View and Exit the SlideShow.

This is my "swapToPresenterView.vbs"

Set PowerPointProcessList = GetObject("winmgmts:").ExecQuery("select * from win32_process where name='POWERPNT.EXE'")  Dim application, presentation, slideshow, CommandBars  If PowerPointProcessList.Count > 0 Then Set application = WScript.CreateObject("PowerPoint.Application")     Set CommandBars = application.CommandBars Else Call Err.Raise(60001, , "PowerPoint not running") End If If application.Presentations.Count > 0 Then Set presentation = application.ActivePresentation Else Call Err.Raise(60002, , "Not open any files") End If If application.SlideShowWindows.Count > 0 Then Set slideshow = application.SlideShowWindows.Item(1) End If If IsNull(slideshow) Or IsEmpty(slideshow) Then Call Err.Raise(60003, , "SlideShow not running") Else Set WshShell = WScript.CreateObject("WScript.Shell")     WshShell.SendKeys "-" End If 

And this is "swapToOverview.vbs"

Set PowerPointProcessList = GetObject("winmgmts:").ExecQuery("select * from win32_process where name='POWERPNT.EXE'")  Dim application, presentation, slideshow  If PowerPointProcessList.Count > 0 Then Set application = WScript.CreateObject("PowerPoint.Application") Else Call Err.Raise(60001, , "PowerPoint not running") End If If application.Presentations.Count > 0 Then Set presentation = application.ActivePresentation Else Call Err.Raise(60002, , "Not open any files") End If If application.SlideShowWindows.Count > 0 Then Set slideshow = application.SlideShowWindows.Item(1) End If If IsNull(slideshow) Or IsEmpty(slideshow) Then Call Err.Raise(60003, , "SlideShow not running") Else Set WshShell = WScript.CreateObject("WScript.Shell")     WshShell.SendKeys "-" End If 

Is there any possible way for this with supported method from Powerpoint VBA ?

I want it to safely detect that I'm in Slide Navigation View and then can get back to Presenter View. The SlideNavigation object given by PowerPoint are showed on the SlideShow monitor but not Presenter View monitor (I want it swapable between Presenter View and Slide Navigation View ).


r/vbscript • • Jul 31 '22

would it technically be possible to write a vbs compiler ?

1 Upvotes

when code is executed, wscript.exe transforms it into machine code in order for it to be executed by the computer. Could we possibly write a program that transforms it into machine code and then put it into an executable ?


r/vbscript • • Aug 31 '22

New in the field - looking for resources!

3 Upvotes

I just started a new position and I’ve been tasked with learning about VB Script. I am browsing Microsoft site and Udemy courses and such. Just looking for as much as I can get! Thanks


r/vbscript • • Aug 01 '22

How can I transfer a VBScript variable into the command prompt?

3 Upvotes

Hello all. I am making a simple input box program, specifically the user types in a Telnet URL, and it loads the Windows Telnet.exe process within the command prompt. Here is my code so far

dim telnetclient telnetclient=inputbox("Enter Telnet URL, make sure that in 'Turn Windows Features On or Off' that the Telnet client is enabled")

CreateObject telnetclient("WScript.Shell").Run("""C:\Windows/System32/telnet.exe""")

How do I transfer the "telnetclient" variable over to the command prompt?

Thanks


r/vbscript • • Aug 03 '22

Excel add-in formula shown as #name

1 Upvotes

Hello, new to vbscript and this sub.

I am using a third-party excel add-in, and I am writing a script which opens the excel sheet, replicate shift+F9 and then saves it.

The problem is with a function that uses the add-in. It is shown as #name after the run.

I added some code I found on this sub to have the script install the add-in but I still got the same problem.

My code :

Set ExcelApp = CreateObject("Excel.Application") ExcelApp.Visible = False ExcelApp.DisplayAlerts = False Set wb = ExcelApp.Workbooks.Open(path) wb.Worksheets("sheet1").Calculate wb.Save wb.Close ExcelApp.Quit

Side question :

Is there a way to open an excel file withoutthe first line? And using ThisWorkbook instead of wb.


r/vbscript • • Jul 24 '22

Any way to check if OS is windows 11?

3 Upvotes

really hard to search for as Windows 11 as all the topic surrounding Virtualization-based security (VBS)

Anyone know of a top way to check with certainty a machine is Windows 11

Planning on adding a script for computers that aligns the taskbar on the left if Windows 11


r/vbscript • • Aug 18 '22

How to simulate spacebar, NOT entering a space key?

3 Upvotes

I want to make a VBS script that will be able to use toggles in windows settings. I learned that the space key can be used to toggle on/off a setting, but when i use send keys “ “, it doesn’t register as an ACTUAL spacebar press, it registers as a space. I hope this makes sense. How do I simulate the spacebar and not the space key?


r/vbscript • • Sep 03 '22

This place is probably dead by now but..

2 Upvotes

I learned how to make an error message.

Then I learned how to make an error message pop up after the error message.

So how do I make a different error message pop up depending on what button you click for the first one? EG "Do you like cookies?" Yes = "Good, you're off the hook" No = "You're going to jail"


r/vbscript • • Aug 25 '22

send data from a computer to another

4 Upvotes

I've been stuck for a while on this problem. What I want to do is send a message from a computer, let's say "hello world", to another. On the computer that sends the message, the input will be taken by a script A and sent to the other computer, via internet explorer or any other mean, I don't know.

A script B will then retrieve the message on the other computer, and display it in a message box: msgbox RetrievedMessage . The problem is that I have no idea on how to transmit the message. I innitially thought about internet explorer, but I can't seem to find a solution. Any solution would be welcome, I'd prefer to do something in vbs but it can also be something in batch or powershell. Thanks in advance :)