Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


VB Script





VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.

Share tech news, updates, or what's on your mind.

Sign up to Post


I have content as mentioned below in a cell in EXCEL sheet. I wanted to split the content based on keywords "NAME", "EMPLOYER" and "DESIGNATION" into three different columns.


Please let me know if this can be done using VB script or macro and help me with logic.

Free Tool: SSL Checker
LVL 11
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I am getting "System Resource Exceeded" when exporting using VB 2015 application and Access MDB file. On my development PC in VB Studio I get no such error. Dev PC is 64 bit Windows 7 PC with 8 Gig RAM. The Live PC that is incurring the error is Windows 10 64 bit with 8 Gig RAM.

Is there an option for OLDDB similar to this one below that I can increase this setting? Any other ideas? I found a hotfix for this on Microsoft web site but it has been expired and the registry entries they suggest to change do not exist on the Live PC.

SUGGESTED in other articles: "dbEngine.SetOption dbMaxLocksPerFile, 100000"
I have Excel 2010.  The following vbscript file is executed by a scheduled task.  It opens a file to update it, save and close.  The file has the "read-only recommended" option on and my script must answer this prompt with "no" which is not the default.

Option Explicit
Dim objXL
Set objXL = WScript.CreateObject("Excel.Application")
With objXL
      .DisplayAlerts = False      
      .WorkBooks.Open FileName:="S:\Schedule\EngDates.xlsm", ReadOnlyRecommended:=False, IgnoreReadOnlyRecommended:=True
      .DisplayAlerts = TRUE
      .Visible = TRUE ' Optional
      .Run "EngDates.xlsm!UpdateDash"
End With
Set objXL = Nothing

I have tried several different syntax formats, with and without parentheses, and nothing has worked yet.
When I run this script, I get an error as seen in the attached file.  Does anyone see the problem with my syntax?  
Hello All,

This is an extension of a question here - https://www.experts-exchange.com/questions/29071843/Display-Query-Results-in-Message-Box.html

I'm trying to "cache" the results of the input box and re-use it on reload of the script.

My thought is this:

Is it possible to send the result of objRecordSet("ID") to a spreadsheet, then put that result from the spreadsheet as the default data in the input box?

So, the below code works fine. It populates the fields as it should but I want to send the objRecordSet("ID") to the
spreadsheet and retrieve it from the spreadsheet at reload of the script to be input box default value - see bold font I added that's not part of the original script.

So, in effect each ID the user enters in the input box will be the default value when they re-run the script.

If there's another way to do what I'm asking, I'm all ears! I hope this makes sense, thanks!

strKey = InputBox("Enter Person ID","Search", MyDefaultValue)
If strKey = "" then
Field1 = ""
Field2 = ""
on error resume next
strConnection = "Provider=SQLOLEDB;Server=;Database=;User ID=;Password="
strSQL = "SELECT * FROM Table1 where ID LIKE '%" & strKey & "%' or User_Name LIKE '%" & strKey & "%'"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open strConnection
Set objRecordSet = CreateObject("ADODB.Recordset")
objRecordSet.Open strSQL, objConnection, adLockReadOnly
do while objRecordSet.EOF = false
Field1 = …
Please, I have the following code and It's works fine :

strOutputFile = Left(WScript.ScriptFullName, Len(WScript.ScriptFullName) - 4) & ".csv"
Set objFSO = CreateObject("Scripting.FileSystemObject")
strLine =  """ou=Accounts,ou=Sales,ou=USA,dc=Dom,dc=local"",""DC1Serv.dom.local"""
If InStr(1, strLine, "DC=", vbTextCompare) > 0 And InStr(1, strLine, """,""", vbTextCompare) > 0 Then
             ' Search entire Active Directory domain.
            Set objRootDSE = GetObject("LDAP://RootDSE")      
            arrBits = Split(strLine, """,""")
            strOU = Mid(arrBits(0), 2)
            strDC = Left(arrBits(1), Len(arrBits(1)) - 1)
            strBase = "<LDAP://" & strDC & "/" & strOU & ">"

I want to add another OU to export the informations from two OUs of the same domain;


Please can you update the script to  export the informations from two OUs

Thank for your help;

Best regards,
how should i setup or design the VBA code wit the condition as below ?

I would need all new incoming emails (doesn't bother who is the sender) , if detected keyword (i got 5000 server name) in email body, auto categories as x(color) or y (color).
Should the code need to pointing to Excel/txt file or all 5000 keyword should import into the code ?

\\FYI, the 5000 keywords is unique.

 I have a MS Access to duplicate current record and it is generating an error when the user clicks [Duplicate] button and I have the following VB code:

    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70

I am running Access 2013 on this computer. On other computers that are running ACCESS 2010, the [Duplicate] button works just fine.

 I checked the settings in reference (please see the screenshot posted) between this computer w/ Access 2013 and working computer w/ Acces 2010 and it is the same.

Fyi, I use the following code to open the database and set recordset to the table.

    Dim rst As Recordset
    Dim db As Database
    Set db = CurrentDb()
    Set rst = db.OpenRecordset("customer")

 What do I need to do to make it work?
I have a PowerShell script that collects data from Active Directory and puts it into a nicely formatted Word Document and appends the date at the end of the file name when it is saved so I can see the different files and when they were ran.
I then run the Document Merge in Word to save the file with the differences indicated between the last two times the script ran.
***I want to automate this process.***

I don't want a third party application to do this.  I want to be able to do this with either PowerShell or VBS or a VBS called out from with in a PowerShell Script.
To check health of our customized Windows appliances after Meltdown patching,
I'll need a  bat/cmd/vb (don't want Powershell) script to :

1. to list the 1st 5 lines of output (which we'll run before patch/reboot & after to compare)
2. the patch date+time  &  compare with the last reboot date/time & the date a registry
     key is added : the sequence should be  add registry key 1st, apply patch & last reboot
     date/time last

1st 5 lines:
DISPLAY_NAME: ArcSoft Connect Daemon
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
. . . . .

DISPLAY_NAME: Ac Profile Manager Service
        TYPE               : 10  WIN32_OWN_PROCESS
        STATE              : 4  RUNNING
I have a script that just stopped working a few days ago, when it had been working for the past three months. The script runs from a user's local drive, and only fails for a few users with a "File not found" error. Both popups are displayed, so I know both source and destination exist. The strange thing is, I added the last if statement when trying to figure out this issue, and that copy works. Has anyone ever seen this happen? What am I missing here?

set ws = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strLocalFolder = "C:\USERS\MyLocalFolder\" 

strRemoteFile = "\\ServerName\RemoteFolder\test.dat"

If (objFSO.FileExists (strRemoteFile )) Then 
	ws.Popup "Found file " & strRemoteFile 
End If

If (objFSO.FolderExists(strLocalFolder )) Then 
	ws.Popup "Found folder " & strLocalFolder 
End If

objFSO.CopyFile strRemoteFile, strLocalFolder, True

If (objFSO.FolderExists(strLocalFolder )) Then 
               objFSO.CopyFile  strRemoteFile, strLocalFolder, True
End If

Open in new window

Concerto Cloud for Software Providers & ISVs
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Please see the attached sample file.  The existing code works which splits out rows into separate workbooks based on an ID in column C.  Part of this code looks at specific IDs and if found groups them together and places them in new workbooks.

I am seeking assistance on modifying the code so that it also does the following:

  • Create a new workbook called JN9 if the number in column C begins with 007 and 000037 (all in one book) but excludes 007005 which should be left to run for the bulk of the primary code.  
  • Create a new workbook if the number in column C begins with 14 called IC1
  • Create a new workbook if the number in column C begins with 13 called IF1
  • Create a new workbook if the number in column C begins with 12 called S1
  • Create a new workbook if the name in column K has Franklin, Ben, Carter, Jimmy, or Clinton, Bill called Org1

These 'exceptions' should be identified first before the primary code runs so the appropriate workbooks are built.

Any assistance would be greatly appreciated.

SAPI-FULLRELEASE1.9-.vbsI need to know how to add a HTML interface to my personal assistant. Please help!
I have been looking, without success, for a method to log which of several DFS targets a user is mapped to at logon.  We already have a process in place that, at logon, records certain useful information to a central file share.  That info is then added to a database for reporting.  I was trying to find a way to add the connected DFS target to that info.  There is a suspected issue with some users being mapped to DFS targets outside their sites, leading to file sharing issues.
You can open a mapped drive's properties in Explorer, go to the DFS tab, and see which target path is active, but I have not found a method to do so in script or remotely.
Hi there.

I have some views on my  SQL server that I show on my web application in a simple table, and I have the feature to click an Excel icon to open the output in Excel.
I do also have some dynamic queries/Stored Procedures where I don't know the number of columns. In the views above I know the columns and wrote a code like this:

<%@ Language=VBScript %>
<!--#include virtual="/includes/conxxxxxxasp" -->
dim Conn,RS1
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS1 = Server.CreateObject("ADODB.RecordSet")
strConn = MM_conmcd_STRING
Conn.Open strConn 
sql1 = "SELECT var1, var2, var3, var4, var5, var6 FROM tbl_xxxxx ORDER BY var1 ASC"
RS1.Open sql1, Conn 
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=xxxx_export.xls" 
<table border="1" width="100%">
<td bgcolor="#000080"><font color="#FFFFFF">var1</font></td>
<td bgcolor="#000080"><font color="#FFFFFF">var2</font></td>
<td bgcolor="#000080"><font color="#FFFFFF">var3</font></td>
<td bgcolor="#000080"><font color="#FFFFFF">var4</font></td>
<td bgcolor="#000080"><font color="#FFFFFF">var5</font></td>
<td bgcolor="#000080"><font color="#FFFFFF">var6</font></td>
<%Do While Not RS1.eof%>
Set Conn = 

Open in new window

I had this question after viewing "More than One Message or Notes Control" error in VBA when creating Outlook mail item..

I am seeing the same issue as the previous OP, although I do not always get the error. I am creating a new mail item (with an attachment). Up until a month ago it worked 100% of the time. Now it works about 75% of the time, I cannot figure out how to replicate the issue, i.e. it seems random. 25% of the time, the email displays with an additional set of buttons and textboxes, and when this happens none of the buttons, or text fields can be mouse selected. I can work around it by closing the email (save as draft) and than opening it from the 'drafts' folder, this workaround works 100% (so far). This behavior has never happened when just creating a new email from within Outlook, only when the VB app creates the email.
Outlook FailAs far as the error goes, I only get that about half of the times that the email displays/behaves wonky... and never when it displays/behaves correctly. The message simply says: "This form has more than one Message or Notes control. If more than one control is visible at run time, only one control works."
Outlook WarningHere is a code snippet for the new mail bit...
        Dim Outl As Interop.Outlook._Application
        Outl = New 

Open in new window

objCommand.ActiveConnection = objConnection                              'assignment to an existing ADO connection
        objCommand.Properties("Page Size").Value = 1000                          'set the Paged Results value to 1000 (AD standard)
        objCommand.Properties("Cache Results").Value = False


        objRecordSet.CacheSize = 500
        objRecordSet.PageSize = 1000

Or Both
I'm creating a service website using visual studio 2015 and VB web form site, I need the user to select a date to book in for a service using calendar control and for that date to be put into car service date field in the database which is NULL at the moment,  how would I go about doing this, I'm struggling because I'm new to VB and many website tutorials cover c# for this particular question.
Help. I need a very simple ASP.NET VB web page to send a single word to a Desktop VB Application on another computer on my network via client/server socket. The Web server is IIS on a local server.

So when a user clicks a button I need a single word sent to the remote application (ie, on port "9999" for example.

Don't know where to start!
I have a combination of Access applications currently in use. They are NOT garden variety. There are no bound forms or controls, and basically we are really just using Access as a platform from running VB. We have over 1600 stored procedures (or "Queries" if you prefer), 360 tables, 200 forms and something approaching 700 pages of code. This total is held down significantly by the use of data driven query assembly and report generation.

Unfortunately, Access simply can't work with remote data servers. Our back end databases were moved to a remote location as a precaution during Hurricane Irma and we couldn't even open them. Attempts to run Access over VPN connections are a frustration clinic. I have even created a local Job Queue to run jobs requested by users in remote locations.

Equally unfortunate is the fact that at some point we will lose our local server. So between now and then, I need to find a development platform that will still allow all of the robust functionality we have in Access, but will also us to use back end data files at remote data centers. Most of the advertised "Access Alternatives" appear to be fine if you are replacing an app with 5 tables, three forms and 10 queries. We need something that will continue to allow us to build powerful applications for a non-developer user population. And the whole team is 2 people!

Suggestions welcome!
Industry Leaders: We Want Your Opinion!
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

w3socketc.dll can work both vb, asp and php? Could anyone  replay me. I need it badly.
There is a server and I need to socket connection and give some command and get output from there. Now it is connected w3sockets.dll vie VB. I wants to convert it to php but I am stacked at connection stage. Only telnet is enable there. Please help me regards this issue.
Hi there.

I have  this stored procedure as you can see here:


It has got a build in parameter Y/N whether it shall create/flush a table or not. How do I run the SP via VB code? And can I kinda build in the Y or N when launching it via VB?

Best regards

I'm looking for a script that I can automate or run manually in order to find expired user accounts.  It's a 2003 to 2008 Windows environment and looking for a way to make my work more manageable and less tasking.  Any user account that has not being used in the last 60 days is supposed to be disabled and have a huge number of users and would love to manage those accounts better.  I need a simple script that I can automate or run it every other week or so.

Hello to all VB Guru's

I'm trying to make a vb script (.vbs) subroutine that will:

Continually check if a process (.exe) is running
Once it's done running (finished), then launch another program (.exe).
Everything I've tried to far, doesn't work.

Really appreacate all your assistance!


I am printing view using lotusScript and HTML on web, I have set 100% table width.

HTMLPrint= HTMLPrint+ ""+tableStarter+"" + "<TABLE BORDER=""0"" CELLSPACING=""0"" CELLPADDING=""0"" WIDTH=""100%"" >"
                  HTMLNewArticle =HTMLNewArticle +   "<TABLE class = ""blueTable"" BORDER=""0"">"
Now for one of the TD on web takes too much width even thought it is data field.

After this I have set <th widht =""10"">datereview</th>
and while printing data i set <td width=""10"">doc.datefield(0)</td>
but while previewing on web it takes too much width while other who suppose to get proper width are getting smaller and wrapping in another line.
Hi there.

I work on this web database with SQL Server back-end and classic asp/VB/Java script front-end. It's all on a dedicated Windows server I control almost a 100%. So far I used a login procedure where - at login - the page call a table in the database with user credentials and return a "Go" or "No" to proceed to other pages for logged in users only. A cookie is created at "Go" and will expire after an hour of inactivity. When expired, the user is returned to the login page.

Now... I have to implement a procedure:
Every 3 month a users password must be changed and live up to certain criteria like upper/lower case, number, special character etc.

Option 1: I can try to program something in VB?? (I need help or some good suggestions)

Option 2: I can skip the present concept and create all users on the server. To access the server a SMS pass code is required on top of the login credentials. But how can I implement the Windows Server authentication to the asp/VB coding?

I would be very happy for some support here. It's a little new territory for me.

And I'm sure it could work better with VB.NET, but that gotta wait some months. First I must make it work in classic asp/VB.

I look forward to some wise words. :-)

Best regards


VB Script





VBScript (Visual Basic Scripting Edition) is an interpreted scripting language developed by Microsoft that is modeled on Visual Basic, but with some important differences. VBScript is commonly used for automating administrative and other tasks in Windows operating systems (by means of the Windows Script Host) and for server-side scripting in ASP web applications. It is also used for client-side scripting in Internet Explorer, specifically in intranet web applications.