Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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 created 7 templates that I would like to write a Macro for that opens them all in succession for me to manually insert attachments and send.  After trawling a few forums I have cobbled this together however I am now struggling to see what I am missing in order to make this work once assigned to a toolbar button:

Dim template As String

Sub OpenTemplate1()
template = "C:\Users\COsbourn\AppData\Roaming\Microsoft\Templates\Template1.oft"
End Sub

Sub OpenTemplate2()
template = "C:\Users\COsbourn\AppData\Roaming\Microsoft\Templates\Template2.oft"
End Sub

Sub OpenTemplate3()
template = "C:\Users\COsbourn\AppData\Roaming\Microsoft\Templates\Template3.oft"
End Sub

Sub OpenTemplate4()
template = "C:\Users\COsbourn\AppData\Roaming\Microsoft\Templates\Template4.oft"
End Sub

Sub OpenTemplate5()
template = "C:\Users\COsbourn\AppData\Roaming\Microsoft\Templates\Template5.oft"
End Sub

Sub OpenTemplate6()
template = "C:\Users\COsbourn\AppData\Roaming\Microsoft\Templates\Template6.oft"
End Sub

Sub OpenTemplate7()
template = "C:\Users\COsbourn\AppData\Roaming\Microsoft\Templates\Template7.oft"
End Sub

Private Sub MakeItem()
Set newItem = Application.CreateItemFromTemplate(template)
Set newItem = Nothing
End Sub
What does it mean to be "Always On"?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Hi experts, How to set in sql command the table below where I wish to display by group the field name theId. Please see the table below!

Amount       Desc                                      TheId
10                 fair                                          x
12                 meals                                     y
15                 allowance                              y
15                 fuel                                         x
50                 Medicines                              x

I tried this command but it doesn't work;

Set rs = cn.Execute("Select Desc, theId, Amount from PList group by TheId")
HI Expert
usually i issue these commands manually
i want script to issue in order to cover this task
can you write a simple script for me to cover this two steps

1- change the path of your working directory!!!!!
 cd c:\program files (x86)\Citrix\Licensing\LS

2- execute this command in order to delete all occupied licenses.
for /f "tokens=1,2" %i in ('udadmin -list ^| find /i "_ud"') do @udadmin -f %j -user %i -delete

3- exit and finish

thank you in advance
Hi, I have a couple of macros which needs to be run automatically every day. However after opening the sheet I need to move the tab and press CNTRL+D to download the file. HOw can do that automations. Please advise

Is it possible to insert image (location map ) in the sheet using VBA if I save all the respective images in a folder with Project code as name.

Say for example if I have DS101.jpg ,DS102.jpg (Project Code column in datasheet) saved in a folder. When I run the macro it fetches the respective image for each project and insert at a specified range (Location) in the template.

Please find the attached excel

I have 600 user accounts (within  OU14, OU15 ,OU16, OU17) that i have extracted in a notepad. I need to delete all these user accounts from our active directory which are not required any more. Is there any script or batch file or command that i can use to delete all these user accounts.
If so please post me the syntax to safetly delete them from the AD.

My Ad structure is like this :

Thanks and any help would be great.
I have a datasheet and a template. I need to create around 30 worksheets(in the same workbook) using the data . When I run the macro with 7 sets of data it is working fine (execution time: 3 minutes). But it is hanging if I enter more number of data.

Please find the code I am using:

Option Explicit

Sub PTOTemplateFill()

Dim LastRw As Long, Rw As Long, Cnt As Long
Dim dSht As Worksheet, tSht As Worksheet
Dim MakeBooks As Boolean, SavePath As String

Application.ScreenUpdating = False  'speed up macro execution
Application.DisplayAlerts = False   'no alerts, default answers used

Set dSht = Sheets("Datasheet")           'sheet with data on it starting in row2
Set tSht = Sheets("Project Page Template")       'sheet to copy and fill out

'Option to create separate workbooks
    MakeBooks = MsgBox("Create separate workbooks?" & vbLf & vbLf & _
        "YES = template will be copied to separate workbooks." & vbLf & _
        "NO = template will be copied to sheets within this same workbook", _
            vbYesNo + vbQuestion) = vbYes

If MakeBooks Then   'select a folder for the new workbooks
    MsgBox "Please select a destination for the new workbooks"
        With Application.FileDialog(msoFileDialogFolderPicker)
            .AllowMultiSelect = False
            If .SelectedItems.Count > 0 Then    'a folder was chosen
                SavePath = .SelectedItems(1) & "\"
                Exit Do

I need a batch file script to execute from a citrix.  We need to publish 10 Websites in single page. User will select and click the website they want to use.  We used for Menu.hta and loading sites file into Menu. We are using Excel now for this but not looks good. can anyone provide script with other ideas to help me on this?
Trying to extract data from website into excel.
Site is https://www.btcmarkets.net

I am after the exchange markets data.

I have tried the DATA - from web approach by doesnt allow me to get table.

Can anyone help

See Attached:

I'm trying to customize this Excel Checklist Template that I obtained from the following link:


File Name: 08_check_list_more_columns.xlsm

I'm trying to add more columns between columns D & E without messing up the Percentages.  When inserting extra columns, then checking off the boxes to mark it as complete in the row, the Percentages on the top don't match up with the column check boxes that were just changed, it pushes them to the right one.

When the document is open you can hit "ALT + F11" to open up the VBA Editor.  I've tried to diagnose where I would change the correct entry so that it doesn't mess everything up when I add the extra columns but I can't find it.  I"m not a coder or understand how they created this so please explain in detail.

Please HELP!!!!

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.


I am looking for  a VB script that would search full name or user name in the Excel spreadsheet.
It would be great if I could type user name or full name in the search box and scan against Excel Spreadsheet
The output should be exported to csv file and display on the page.

Can you please help me?

Thx, M
Outlook 2010
access 2010

I have in the past opened a "outlook custom form" from Access.
and fill fields on the custom form with data.

What I need:.
Is it possible to create an HTML table on that Outlook custom form from Access?

I know how to create html table from access and load the data on an standard email...
just did not know if
VBSCRIPT was going to allow me to do that on an Outlook custom form ?


I looked on outlookcode.com but also
Cant seem to find much on the internet.

I want to process multiple files from the folder.

This is code.
$file = 'C:\temp\RP\test'
$xlApp = New-Object -Com Excel.Application
$xlApp.Visible = $false
$wb = $xlApp.Workbooks.Open($file + '.xlsx')
foreach ($ws in $wb.Worksheets)
  $ws.SaveAs($filedest + '_' + $ws.Name, [Microsoft.Office.Interop.Excel.xlFileFormat]::xlExcel12)

I tried using below  but  failed.
$file = Get-ChildItem "C:\temp\RP\" -Filter *.xlsx .

Could any one please hemp in this ?
Well I need a similar Macro to make a Pivot as before but not as complex. I need a Pivot to give me YTD totals.

Report Filter = Task Type (which incident is selected)
Columns = Month
Row Labels = Assigned To
Values = numbers

I need a MACRO to create a pivot Table and export that to a PDF or show as image in another tab then export it.

Worksheet name = 8 Week INC Trend
Report Filter I need , "8 Week Trend", "Task Type"
Column Labels I need "Week Ending"
Row Labels I need "Assigned to"
Values I need "number"

NOTE I do have a name range for my data TAB called "RANGE"
I need a MACRO to export the active sheet to a PDF file.

A client has sent us an excel spreadsheet that references "sheet 3" in some formulas but the sheet is not listed along the bottom with the other sheets and if you right click any of the other 9 sheets the unhide option is greyed out.

Is there any other way to get access to this hidden sheet?
At C35 I have this drop down with names and when selecting the name it will email out the form...that works great and what I wanted to do is duplicate that at B35 but I'm unable to do so.  The Code is there at module 2 for email so I need it to work for the "Email Supervisor" highlighted in yellow.

See attachment.
Hi all,
Extract all word files properties script.
I have few 1000's of files and want to extract all details possible to an excel, so i can compare and take some actions.
Like Owner name/system name etc etc
Can anyone help me please
New benefit for Premium Members - Upgrade now!
LVL 10
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Hi experts, I have a database with the following datas;

code     description     Qty     Date
1175     Para                  1        9\12\2017
1188     Amox                3        9\12\2017
1175     Para                  2        9\12\2017
1188    Amox                 2        9\12\2017
1199    Cefa                    1       9\12\2017

We can see here, two Para and two amox. I want them to merge or add its quantity that would result with the follwing view;

code     description     Qty     Date
1175     Para                  3        9\12\2017
1188     Amox                5        9\12\2017
1199    Cefa                    1       9\12\2017

How to set a condition to achieve the goal? I have a solution but this is not working for this purpose.

Set rs = cn.Execute("Select code, description, quantity  from SoldItems")
I had this question after viewing Auto Close a Microsoft Word document with a VB MACRO.

It was very informative and was a macro for exactly what I wanted.

Unfortunately, when using that code and creating that macro then when I double click on the file then it would only open word and not the file.  
Once word was open then if I were to double ckick on the file, or opened the file from within word, then it would open and work fine.

I do not know if there is any way around this or what is specifically causing this in the macro itself that it does not open the document unless word is already running.

If you have any advice I would be most grateful!

Thank you,

Here is the original Macro instructions:

-Open the document you want to do this to
-From Word, press Alt-F11 to open the VBA/Macros editor (VBE) window
-Press control-r in the VBE to open/focus the Project window
-Look for the Project for the file you want this to happen on (should look like "Project (YourDocumentName)"
-Expand that project if not already expanded
-Expand the "Microsoft Word Objects" folder if not already expanded
-Double click on the "ThisDocument" object in that folder.
-In the code pane that opens up from there, paste in the following:

Private Sub Document_Open()
End Sub

-Now, right-click on the ThisDocument object in the …

I'm trying to find or create a VBScript that can query an AD "domain-local" group and export the members of the group to a text file.
The export of the members needs to be in the format of:  "DOMAIN\SAMAccountName"

DOMAIN is preferred to be in the NetBIOS format, but FQDN is also acceptable.

I need the domain to be prefaced because there are members of trusted domains in these groups which I must differentiate.

I want to convert file from .xlsx to xlsb. Which  xlFileFormat I need to give in below code ?    $ws.SaveAs($file + '_' + $ws.Name, [Microsoft.Office.Interop.Excel.xlFileFormat]::xlCSVWindows)
We need a solution to retrieve filenames from sub folders in macro for a comparison analysis.
option to select the folders for comparison from D:\ and E:\
We need to break the path in the rows
Match folder/subfolder/filename in D: with folder/subfolder/filename in E:
reflect matched and not matched filenames

Hi People,

I’d like to request some PowerShell scripting help for testing document download and access that have been published by my users to the cloud service.

Steps to do:
1.      Loop through the month directory and then get all PDF published in that directory, then save it to C:\Test\Result\
2.      Go to the next month and then perform the same thing as above

January 2017


Open in new window


August 2017


Open in new window

I wanted to test if the user published the document as per the standard naming convention or not.

Any help would be greatly appreciated.


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.