VB Script

36K

Solutions

25

Articles & Videos

19K

Contributors

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

Hi ,

I am trying to use HTA with VBScript and Excel for Task list tracking and have done everything with excel protecting with password. Now I want to convert with HTA file to .exe file and package the excel along with it. Is there any way with VBScript to open file without giving full path in the code. I am new to scripting and a help is highly appreciated.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("D:\Projects\Tracker.xlsx",,,,"xxxx")
Set objsheet = objExcel.ActiveWorkbook.Worksheets(1)

Regards,
Maha.
0
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!

Hi all,

Bit of a strange one this and I wont try and explain the reason I need this as its pretty long winded!

I would like to try and create a logon script, which when triggered executes a wake on lan command (which references a MAC address, ideally in a .csv list or similar) based on which user is logging on.  I hope that makes sense!

Example

User "STEVE" logs on

1.) Logon script is executed

2.) WOL command is triggerd and looks to a CSV file to match up "STEVE" to Mac address 11:11:11:11:11:11

User "DAVE" logs in

1.) Logon script is executed

2.) WOL command is triggerd and looks to a CSV file to match up "DAVE" to Mac address 22:22:22:22:22:22

Would anyone be able to help me achieve this please?

Thank you
0
Hi Guys,

I need help with visual basic syntax.
I"m trying to create dropdown list on my page with @html helper, so in C# which I'm familiar with it looks like this:
 @Html.DropDownList("ddlAdditional1", New SelectList(ViewBag.Listofitem, "", "id"), New { @CssClass="form-control", Width="180px"}  )

Open in new window


but in VB I think the syntax is different and I can't find what is the right one.

I will be appreciate if you can give me the server side code in vb as well.

thanks,
0
I have a list of files to be FTPed from one server to another.  This process had been working.  Recently, only part of each file was successfully sent.  The files are all 20-30kb.  When sent to the 2nd server, only 3-6kb of each file shows up.

The script loops through the list of files and uses this code to FTP them:
Set objshell _ Createobject("wscript.shell")
objshell.run "ncftpput.exe (server stuff and file names)
set objshell = nothing

Open in new window


I tried to slow the process down by adding a msgbox and it worked:
Set objshell _ Createobject("wscript.shell")
objshell.run "ncftpput.exe (server stuff and file names)
set objshell = nothing
msgbox "Press ENTER to continue"

Open in new window


Next, I tried the sleep command to delay it by 20seconds. It did not work. Only parts of the files were transfered.
Set objshell _ Createobject("wscript.shell")
objshell.run "ncftpput.exe (server stuff and file names)
wscript.sleep 20000
set objshell = nothing

Open in new window

0
I have a code that creates a code in a module, but when it does the VBA window flashes up while the code is running.
I have tried 'Application.screenupdating = false', and it does not work, I have also tried    'ThisWorkbook.VBProject.VBE.MainWindow.Visible = False' at the beginning and end of the code but the window still pops up for a short time. I would like to run the code without the vba window being visable at all.

this is the code:



Sub code
   
        Set vbp = Application.VBE.ActiveVBProject
    Set vbc = vbp.VBComponents.add(vbext_ct_StdModule)
    vbc.Name = "CreateButton"
    strCode = "Sub CreateButtons()" & vbNewLine & _
    "ActiveSheet.Buttons.Add(840, 10, 95, 25).Select " & vbNewLine & _
   " Selection.OnAction = ""ClaimsLog""" & vbNewLine & _
    "Selection.Characters.Text = ""Claims Log"" " & vbNewLine & _
  "  With Selection.Characters(Start:=1, Length:=35).Font " & vbNewLine & _
      "  .Size = 10" & vbNewLine & _
   " End With" & vbNewLine & _
 "ActiveSheet.Buttons.Add(840, 40, 95, 25).Select " & vbNewLine & _
   " Selection.OnAction = ""UNM23Report""" & vbNewLine & _
    "Selection.Characters.Text = ""UNM23 Report"" " & vbNewLine & _
  "  With Selection.Characters(Start:=1, Length:=35).Font " & vbNewLine & _
      "  .Size = 10" & vbNewLine & _
   " End With" & vbNewLine & _
 "ActiveSheet.Buttons.Add(840, 70, 95, 25).Select " & vbNewLine & _
   " Selection.OnAction = ""SPLEtool""" & vbNewLine & _
    …
0
For a program i have nearly ready i need some code what i can't find in VB, only in Python.

import serial
import operator

def ibisString( str ):
bytestring = str+" "
bits = chr(0x7f) + bytestring
checksum = reduce(lambda x,y:chr((ord(x)^ord(y))&0xff),bits)
message = bytestring+checksum
output = map(lambda x:hex(ord(x)),message)
bytes = bytearray(int(x, 16) for x in output)
print output
return bytes

ser = serial.Serial(‘/dev/ttyUSB0‘, 1200, parity=‘E‘, stopbits=2, timeout=1)
ser.write(ibisString(‘l300‘))

Open in new window


Can anyone help me to convert this Python code to VB?
0
How can I run a batch file from within a Word macro?
0
VBA: can someone help me with the code on VBA that takes a screenshot of a specific excel spreadsheet on a specific range of cells and attaches it to an email?
0
If have two fields in a form.

the item number (item) and Count (stored as a string)

I want to be able to compare to see if the item number box and the count box are the same value.

We use barcode scanner (wireless keyboard/scanner) so the info is read from a barcode.  the enter key is pressed as part of the entry, so the cursor moves to the next field.  if the user "double scans" I want to check when the cursor leave the count box, if it is the same at the item box.  If so, I want to be able to clear out the count and let the user re-enter it (without them having to take any action.  So I declared a local variable and want to see if they are the same.  It's like the function does not work, does not matter what is in EITHER BOX, the resulting msgbox always has an answer of 1 (never -1 or 0)
  Dim CompResult As Integer
...
 CompResult = StrComp(Me.Item.Value, CountAsString, vbTextCompare)
 
  MsgBox ("And the boolean comparison results (< -1, = 0 , >1) = " & CompResult)
0
New to powershell

Looking to create a powershell script that will delete all files in folder and sub folders past a certain age.

Thank you
0
Free Tool: Site Down Detector
LVL 9
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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 have this code which will find matching sets of three numbers (and colour them for ID) across a worksheet. (sample sheet attached 007-quad-ID-query-ee.xls )

Could it be adjusted to find those sets of three numbers which match 5 or more times ?
__________________________
Code :

Option Explicit

Private Type Sets
    strAddr As String
    strCells As String
    lngColor As Long
End Type

Sub IdentifyDuplicates()

    Dim lngLastRow As Long
    Dim lngLastColumn As Long
    Dim lngRow As Long
    Dim lngCol As Long
    Dim DupeSets() As Sets
    Dim strSet As String
    Dim lngFind As Long
    Dim lngFound As Long
    Dim lngColors()
    Dim lngNextColor As Long

    lngColors = Array(13494512, 11599871, 13626575, 15723724, 15258845, 12178907, 8518399, 11461045, 14667418, 14136257, 10074816, 5369343, 9491089, 14071663, 12683685, 13233150, 11596768, 14541491, 15259071, 15654653, 10668797, 7791807, 12504966, 13674644, 13743867, 8759804, 6146693, 10728776, 12552565, 11963641, vbYellow)
    lngNextColor = 0

    ReDim DupeSets(0)
    lngLastRow = Range("A65536").End(xlUp).Row
    lngLastColumn = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPrevious).Column

    For lngRow = 4 To lngLastRow
        If Cells(lngRow, 1) <> "" Then
            For lngCol = 8 To lngLastColumn Step 4
                strSet = Cells(lngRow, lngCol) & "," & Cells(lngRow, lngCol + 1) & "," & Cells(lngRow, lngCol + 2)
                …
0
I have this code which sorts groups of 6 numbers into all possible sets of 3 (of which there are 20)

Could someone help and alter it so that it sorts 6 numbers into all possible sets of five please ?

Public Sub Triples()
    intNumbers = 6
    Set wsData = ThisWorkbook.Worksheets("Sheet1")
    For rowCurrent = 4 To wsData.Cells(wsData.Rows.Count, 1).End(xlUp).Row
        colOutput = 8
        For i1 = 1 To intNumbers - 2
            For i2 = i1 + 1 To intNumbers - 1
                For i3 = i2 + 1 To intNumbers
                    wsData.Cells(rowCurrent, colOutput).Value = wsData.Cells(rowCurrent, i1).Value
                    wsData.Cells(rowCurrent, colOutput + 1).Value = wsData.Cells(rowCurrent, i2).Value
                    wsData.Cells(rowCurrent, colOutput + 2).Value = wsData.Cells(rowCurrent, i3).Value
                    wsData.Cells(rowCurrent, colOutput + 3).Value = ""
                    colOutput = colOutput + 4
                Next
            Next
        Next
    Next
End Sub
0
We currently use a Print Script to install and map printers to all users on log in, but are toying with the idea of using Deployed Printers GPO, what have people found the pros and cons of using the two methods above?

Basically we are after a few options...
1. Speed up log in times
2. Make print deployment and management alot easier
0
I have an excel with around 20 fields. I want to validate the excel cell for a specific datatype.
Every cell will have a different datatype.Need help.
0
Hello.
I have a VBScript, which could define a computer IP address, using a website. After sometimes the website turned off this possibility.
Please, can you change this script to make it workable? No matter what website will be used.

Const cstrShowMyIP = "http://ip2country.sourceforge.net/ip2c.php?format=XML"
On error resume next

Dim objRemXML
Dim objMyIP
Dim strIPAddress
Dim strHostname
Dim strCountry
Dim strCountryCode
 
Set objRemXML = CreateObject("Microsoft.XMLDOM")
objRemXML.async = False
objRemXML.Load (cstrShowMyIP)
If Err.Number <> 0 Then
   MsgBox "Error of ip address from " & cstrShowMyIP
   WScript.Quit
End If
 
' Get your IP address
Set objMyIP = objRemXML.selectSingleNode("/lookup/ip")

If Err.Number <> 0 Then
   MsgBox "Error of ip address"
   WScript.Quit
Else
   strIPAddress = objMyIP.Text
End If
 
' Get your hostname
Set objMyIP = objRemXML.selectSingleNode("/lookup/hostname")
If Err.Number <> 0 Then
   MsgBox "Error of ip address"
Else
   strHostname = objMyIP.Text
End If

' Get your Country
Set objMyIP = objRemXML.selectSingleNode("/lookup/country_name")
If Err.Number <> 0 Then
   MsgBox "Error of Country"
Else
   strCountry = objMyIP.Text
End If

' Get your Country
Set objMyIP = objRemXML.selectSingleNode("/lookup/country_code")
If Err.Number <> 0 Then
   MsgBox "Error of Country Code"
Else
   strCountryCode = objMyIP.Text
End If


' Print info
MsgBox " your ip address : " & strIPAddress,,"   …
0
Hello,

I'm aware that various parts of an Excel window (eg gridlines, headings, Formula bar, etc) can be hidden using the View menu and other parts (sheet tabs, scrollbars, etc) can be hidden by going to: File > Options > Advanced.

Recently I came across a thread in Mr. Excel which includes a post (by none other than prolific EE expert Rory Archibald) showing VBA code for how to display the Status Bar in Excel:

application.DisplayStatusBar = True

Open in new window

I actually wanted to hide the Status Bar so I inserted:

application.DisplayStatusBar = False

Open in new window

which worked.

Now I'm wondering what other parts of an Excel (or other app) window can also be hidden using VBA. For example, is it possible to hide the Title bar, Ribbon and/or Quick Access Toolbar in a similar way? If so, can someone post the code?

Thanks
0
Hi

The idea is to use a single shortcut to run a vbscript. I then can copy and rename the shortcut without having to change the target.
So I'm looking for a way to having that vbscript detecting the name of the shortcut that started it.

Yours truly

Filip
0
HI All,

We have got stuck at a task to convert csv to xml conversion. we have tried some VB script solution but that din't worked out.
PFA sample csv and sample xml output as required.sample1.csvsample1.xlsx
0
Hi guys

I've been banging my head on this one.

I have a vbscript that dinamically launches RDP connections to some servers, and it works fine.

Now I need to add to this script to launch a specific command upon connection.
The MSTSC GUI does have this parameter ("Start the following program on connection"), but I'm unable to find someting useful to translate this for VBScript (ie command line).

Is there a way to do this outside the RDP GUI ? I'm thinking to modify the script and build an RDP file dinamically, but that would be quite some work! Is there an other way ?

Thanks!
0
Free Tool: Port Scanner
LVL 9
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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 understand that it is not possible to delay a client side rule from running, but I have heard that it is possible to create a VB script that can.
Situation is, a user has a rule that will print an email and it's attachment when it receives from a specific address. This rule will run as soon as the user opens their outlook ( 2016). I would like to delay this rule for a minute.
Can someone point me in the direction a code that might be able to do this?

Thank you
David Kernaghan
0
I am using vb script for installing an application the before that it has to uninstall older versions...Problem is that it's installing but not uninstalling the older version
0
i need your help to solve my problems. i have a workbook which contains three worksheet name called ( Alpha, Bravo,Charlie) and each worksheet there is a chart and i display all the chart in one worksheet called All in one sheet. Now what i need i need to run the chart as animate of whole year data value or selecting by months wise. if i click button start and stop the chart should run as Animate of whole year.


i attached my file for our reference and video look here

sample file i am attaching please help me it will be great appreciate to me .

i have to animate in worksheet name called ( All chart in one)
2. sample file i attached same like i need to run the chart please...... help me.

if you need any additional details please let me know you can modify the chart as you like of best appearance.
ALL-CHART-IN-ONE-rev1.xlsm
Graphic-animation--1-.xlsm
Expand-Chart-Selection.xlsb
0
is it possible to programatically create a computer to computer voice chat using classic vb or vb.net through internet?

e.g. suppose two computers A in UK and B in USA
computer A is a server  which is connected to a client computer B
at the same time
computer B is a server  which is connected to a client computer A

the user on Computer A Sayes: hellow
    1- the sound is converted to a file (..wav)
    2- the wav file is immediatly sent to computer B winsock
    3- Computer B winsock recieves and play the voice
the user on Computer B Sayes: How Can I help
    1- the sound is converted to a file (..wav)
    2- the file is immediatly send to computer A winsock
    3- Computer A winsock recieves and play the voice
and so on

Because both are servers and clients at the same time then they can both talk at the same time and also listen.

or may be there is a tool better that winsock that does the job, open channel and deal with the voice .....
0
Hello:

I'm composing a simple journal entry import through Integration Manager.  The source file does not have the offsetting account for the credit side of the journal entry.

The following is the VB script that I composed for the mapping of the Account Number for the credit side:

If SourceFields("GL Detail.Account String") = "" Then CurrentField = "230-00-00-00" else CurrentField = SourceFields("GL Detail.Account String") end if

In the mapping for the Credit Amount, I have "Use Default", so that the credit for the journal entry will simply pull in the total of the debits.

The above script compiles successfully.  But, it is not working.  The offset account for the credit of 230-00-00-00 is not being brought in.

How do I configure Integration Manager to accomplish pulling in 230-00-00-00 as the offsetting account for the default Credit Amount?

Thank you!

John
0
Hello Experts,

i have a three worksheet like (alpha,bravo,charlie) each worksheet i have chart and pivot data. i need to display all the chart in one worksheet (sheet name : all chart in one) by selecting the Drop Down list.

i want to animate the chart like when ever i want to run the chart start and stop button data of entire date of year .

i tried so much days but i am failure to solve this problems. Please help me it will be great appreciated!

please find the attachment and  you change your best idea to impress to display chart in better ways.

please if you want any other details regarding to this file i try to explain it more for your clarification. Thanks in advance.

other two excel sheet file has sample example of how i need to display the chart.
ALL-CHART-IN-ONE.xlsm
Graphic-animation--1-.xlsm
Expand-Chart-Selection.xlsb
0

VB Script

36K

Solutions

25

Articles & Videos

19K

Contributors

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.