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

Hello Experts:

I have a text file that I need to:

1) DELETE all asterisks at the end of each row if any.

2) COMBINE all rows with tilde

See attached excel file and Original and New .txt files.

I have a vbs script file that will convert from one row with tilde to different rows. See attache vbs file.

Please help.

Thank you again for all your help.
Cloud Class® Course: Python 3 Fundamentals
LVL 12
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Originally posted here:


I have already posted a similar question before which converts CSV files to xlsx.

This question can be found here:


Code: VBS

Const xlOpenXMLWorkbook = 51             '(without macro's in 2007-2016, xlsx)
Const xlOpenXMLWorkbookMacroEnabled = 52 '(with or without macro's in 2007-2016, xlsm)
Const xlExcel12 = 50                     '(Excel Binary Workbook in 2007-2016 with or without macro's, xlsb)
Const xlExcel8 =56                       '(97-2003 format in Excel 2007-2016, xls)

' Extensions for old and new files
strExcel = "xlsx"
strCSV = "csv"
strXLS = "xls"

' Set up filesystem object for usage
Set objFSO = CreateObject("Scripting.FileSystemObject")

strFolder = "B:\EE\EE29088597\Files"

' Access the folder to process
Set objFolder = objFSO.GetFolder(strFolder)

' Load Excel (hidden) for conversions
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = False
objExcel.DisplayAlerts = False

' Process all files
For Each objFile In objFolder.Files
    ' Get full path to file
    strPath = objFile.Path
    ' Only convert CSV files
    If LCase(objFSO.GetExtensionName(strPath)) = LCase(strCSV) Or LCase(objFSO.GetExtensionName(strPath)) = LCase(strXLS) Then
        ' Display to console each 

Open in new window


done a search and haven't found anything exactly like what I'd like to do.

We have a single domain with users in multiple locations. Each main location has its own file server and users map their home drive based on their location. We've had issues with home drives not mapping in remote locations that do not have a local server. We believe it may be timing out, that issue is being looked into.

Rather than have our IT staff manually map the drives, I'd like to do a small script we could place on their desktop that allows users to put their primary location, which would then map their home drive to the correct server.  Something like this.

Please select your primary location:
0 = HQ
1= Region 1
2= Region 2
3 = Region 3
4 = Region 4

Based on their answer I assume it would then run a command

Net Use K:\\hqserver\vol\%username%

Reg 1
Net Use K:\\r1server\vol\%username%

Reg 2
Net Use K:\\r2server\vol\%username%

Reg 3
Net Use K:\\r3server\vol\%username%

Reg 4
Net Use K:\\r4server\vol\%username%

I've tried writing a few, but scripting is definitely not a strong suit. I'm sure it would take a talented scripter about 2 minutes.

Good Morning,

Just a simple request I have a text file that has various header records and I want to be able to do a count on the header record ‘Order Number’.

Then output to a text file and sorted in A to Z with a total at the bottom. Example below

Order Number.        Total

GB088776               10
VB66666.                 12
HF56778.                 6

Total                          28
I would not even begin to tell you why I need this, but does anyone know the Hexadecimal code for a zero-width joiner or a zero-width non-joiner? [/b]
I have piece of code that produces a progress bar while another piece of code is running it works fine on a windows 8.1 machine but when I try and run it on windows 7 machine I get a Invalid use of null:"SPLIT" If I remove the last line it will run but the progress bar is half off the screen.

Can anyone help me please . Code attached
Great Macro here: https://www.slipstick.com/developer/code-samples/create-task-sending-message/

Creates a Task from a sent message.

One issue: only works if I leave the Trust Center > Macro Settings at "Enable All".

How can I get this Macro to work at the level of "Notifications for Digitally Signed, All Other Macros Disabled" which was the default level at installation.
Trying to create a view with all the values of a field for the same ID into one text field.

I know how to do this in vb but need to know how to do something like this in a SqlServer view.

basically i want to return 1 record with all the information from a field spanning multiple records that have the same criteria.

this is the vb code that pulls the data into 1 variable called cTrackingInfo.

   Do Until RS2.eof
      If RS2("TRACKING_INFO") <> "" Then
         If Trim(cTrackingInfo & "") = "" Then
            cTrackingInfo = RS2("TRACKING_INFO")
            cTrackingInfo = cTrackingInfo  & "," & RS2("TRACKING_INFO")
         End If
      End If

Open in new window

Any help would be greatly appreciated.
AD Users and Groups PowerShell Scripts request:
1.  To get one particular OU AD  Users with Group membership details in CSV file. Parameter: AD Group Memberships, Email ID, Account Name, Account Expire Date, Enabled/Disabled.
2.  To get one particular AD Group Users details in CSV file. Parameters: Email ID, Account Name, Account Expire Date, Enabled/Disabled.
I have a couple of VBScripts that were generated a couple of years ago as one of the options in CuteFTP Pro. The scripts connect by FTP, go to my website, then upload or delete certain files. They've worked fine with no problems every month until recently.   Now, I'm getting this error message:

Error Message That Appears When Trying to Run the Program
With a little help from an expert here on EE, I think I've narrowed down what the problem really is. I don't think the problem is with CuteFTP.  I think it is connected with some type of Microsoft system operations, and I have a feeling that an expert versed in Visual Basic can help me get the scripts running again. It looks like the problem is connected with the "Library Not Registered" notation, but that's as far as I can go on my own technically.

Here's part of one of the scripts in question:
' VBS Script Generated by CuteFTP (TM) macro recorder.
' Generated at: 4/8/2015 4:51:49 PM.
' Revised 9/1/2015
' MASTER Upload Spots Script - Oldies - Six Spots

' Create TEConnection object
Set MySite = CreateObject("CuteFTPPro.TEConnection")

' Initialize remote server host name, protocol, port, etc.
MySite.Host = "ftp.[mywebiste].com"
MySite.Protocol = "FTP"
MySite.Port = 21
MySite.Retries = 30
MySite.Delay = 30
MySite.MaxConnections = 4
MySite.TransferType = "AUTO"
MySite.DataChannel = "DEFAULT"
MySite.AutoRename = "OFF"
' WARNING!!! SENSITIVE DATA: user name and password.
MySite.Login = …
Cloud Class® Course: Certified Penetration Testing
LVL 12
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Split text file:

I have a text file with hundreds of lines, each line starts with either "N" or "I"

The help I would need is the file should copy from N(New line) and lines with "I" needs to be in single file; from the below example N- 00000 is one file N- 00001 and N- 00002 is another file


N- 00000
N- 00001
N- 00002

Please help either with vbs or windows command line or regex or vba
I’m looking for a possible procedure...

I have a list of PDF documents in a text file and I want to search for that PDF document in another folder. When it finds a match, i want  it to renamed with a new name corresponding to the name in the original.


Text File

Test.pdf, NewName.pdf
Test1.pdf, NewName1.pdf
Test2.pdf, NewName2.pdf

The procedure should work by going through each line to the find the file and rename with the new name.
I use CuteFTP to upload files to my website on a regular basis. Last year, I learned that CuteFTP will record keystrokes and allow you to create a vbs file to run for future use. I saved several of these files, and thanks to having messed around with BASIC and QBASIC way back when, I was able to modify them to perfectly suit my needs. But a few months ago, when I went to run the files,as I had been doing without problem, I got this message:

Screenshot of error message
And, I just don't know what happened or how to fix it. So here I am.


I have built a document management system that is interfaced into Access using treeview. It works fine but when I add files to the system I want to refresh the treeview and expand the node to which the files were added to display the added files.

Is it possible to search treeview nodes using text and expand node that matches search?
Split 1 text file into multiple textfiles based on Row starts with CC and rename the files into different file name.

Rows AA, BB are headers need to be added to the file after the split. Split based on Row CC.

I don't know what is the best way to do this. I am lost.

Is this possible?

See attached:
Original File to be split: Test_05022018.txt

Results should be like this: See attachement.

See attache excel file for more info.

Please help.

Thank you again.
Good Afternoon Experts

I am trying to find a way to create folders in a directory based upon a list of names for the folder name.

Hope you can help
Hello all:

We have hybrid O365/On-Premise environment. I have an O365 shared mailbox that receives transcribed voicemails.  What I would like to do is create a script that will look in a folder (perhaps the inbox) and when a transcribed voicemail email come it, it will do the following:

1) Change the subject line
2) Add some text to the end of the email
3) Forward the email to another mailbox

So basically I need a watcher script that will watch an inbox, and when this type of email comes in it will process it into a case.

For a project i'm working on i need to quickly rename several 100 images.
i'm familiar with batch rename or find/replace command, but since there's no constant in the new/old file names that is not an option:

I have a MS excell file with 2 columns
Column A - old file name - for example ABC.jpg
Column B - new file name - for example 123.jpg

the extension .jpg will be in the cell
i also have  2 image folders

C:\FolderA - contains over 4,000 product images
C:\FolderB - empty

the intention is that i define the range of cells Columns A&B, and call the range PHOTONAME
i execute the macro

the macro reads value from Cell A1 and checks if FolderA contains an image with the same name (this should NOT be case sensitive if possible)
if so, it make A COPY off this image to FolderB and RENAMES the image to the value of Cell B1 - same row

if the folderA has no image named with the value of cell A1, the macro moves on to the next row

an added difficulty might be that some images contain . - point and stripe
for example  123.456.jpg or 123-abc.jpg

Can someone create a macro for this ?
Hello, I am trying to use VBScript to check multiple excel files in a folder and move them to another folder if cell "A2" is blank. The Header row will always be populated with the fields, but the actual data is not present, meaning the file is blank. Below is the code I have that moves the excel files if they are 5kb or less:

' VBScript.

Option Explicit
Sub ProcessFiles()

'Declare the variables:
Dim FSO, oError, oFile
Dim dtmValue, strDate, Mth, The_Date, TheDate

'Create the file system object for creating folders:
Set FSO = CreateObject("Scripting.FileSystemObject")

'Get current date into variable:
dtmValue = Now()
Mth = Month(dtmValue)
The_Date = Mth&"."&Day(dtmValue)&"."&Year(dtmValue)
TheDate = Right(String(2,"0")&Month(date),2)&"."&Right(String(2,"0")&Day(date),2)&"."&Year(date)

'Use date part functions to create the folder names as required
strDate = "O:\Everyone\Claims\Recovery\Payment Integrity DataMining\Data Mining Files " & Year(dtmValue)& "\" & MonthName(Mth) & "\Prospective"

Wscript.Echo strDate
Wscript.Echo The_Date
Wscript.Echo TheDate

'Set variable for that folder name:
Set oError = FSO.GetFolder("O:\Everyone\Claims\Recovery\Payment Integrity DataMining\Data Mining Files " & Year(dtmValue)& "\" & MonthName(Mth) & "\Prospective")

For Each oFile In oError.Files
If oFile.Size <= 5120 Then
   'FSO.CopyFile oFile.Path, "O:\Everyone\Claims\Recovery\Payment Integrity DataMining\Data Mining Files " & Year(dtmValue)& "\" & …
Free Tool: IP Lookup
LVL 12
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Dear All

            I'm looking for a vbs that can help to copy Folder from one network drive to another location by using task schedule manager, below is the one i found from internet, but only workable for copying files, not a folder, do any one know which vb script that can copy folder as well ? thanks

I want to rename all of Mp4 files to 1 2 3 4 5 6 7 ... so on

but the numbers sequence should be based on the created date-time   so all of my files are created today but their timing for creating them are different.

so 1 should be the name of the latest time of creation of the Mp4 and then 2 should be the name of second latest created

how can i do this automatically?
Does anyone have an example that does something like the below for the attached ?

 1. sort by "Next Due Date" in "Oldest to Newest" order
 2. highlight rows were "Next Due Date" < today+7 to get everything that is due in the next 7 days
 3. print above section to default Windows 10 Pro printer
Hello Experts,

I am trying to find the best way to send emails to our clients and attach an inspection report that been generated as a PDF.

I have a CSV file that contains our client details and I want to set something up that does an email merge with the attachment. It is something I want to be able to schedule if possible.

Is there any programs that are reliable?

The only way I have thought of is the sending emails from excel using VBA. Then scheduling an script to run an macro in the spreadsheet to send the emails.

This process works but you need to have outlook open on the server and sometimes the spreadsheet gets locked and then hangs.

I am open to suggestion...

I would like to delete the contents of a text every day;  instead of deleting the actual file.

What is the best way to do this?
Hello Experts...

I have excel spreadsheet that has 3 macros. I have done some research and I want to use a script to call these 3 macros in order.

So I want the script to open excel, run the macros and then close..

Any ideas?

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.