VB Script

37K

Solutions

20K

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.

I need to automate a task in Outlook.

I need a button in an email form to open an email in a new forwarding form, change the From: field to another account and add a particular address in the To: field then send the message. This will change a 6 click & 1 keystrake operation into 1 click.

I expect this can be done with VB code assigned to a custom button the the ribbon or the Quick Access Toolbar

Thanks in advance
0
Hi,
I get type mismatch error to right line below

        tm = Replace(Cells(rw, 3).Value, ".", "")
        If Trim(tm) = "" Then
            tm = ""
        Else
            tm = Right("0" & Hour(tm), 2) & Right("0" & Minute(tm), 2)
        End If

Open in new window

with this values. Please help.
20a.png
0
I would like to modify this script or even have another script run on the output if needed, so that any data in the output file which are "numbers stored as text"
will be converted to "numbers"... and the file resaved.
CSV-to-Excel-Copy.ps1
0
Hello,
I am looking for a vbscript to find files with filenames of a certain length within one folder
and
another vbscript to delete files with filenames of a certain length within one folder
0
The code makes combinations from data in B10:AG19 in "sheet1" and puts them in sheets "NumbersX" where "X" is 1-10.

When the code is executed again it deletes data in sheets "NumbersX" then writes new data.

The goal here is to edit the code to:


1) Number the sheets using the number in B10:B19. In this instance "Numbers_3, Numbers_4, numbers_7, etc.

2)  write combinations using only the first number (located in B10:B19). After it is finished wit combinations that match the first number stop with that sheet then go to next sheet, etc.

FYI: I have 1) manually edited sheet names to match the desired result and the first sheet shows only combinations with the number 3 that matches the number in B10.

There is no data in the last sheet since there are no numbers in B19:AG19
CreateCominationsFromGoups_2-2020_F.xlsm
0
The code makes combinations from all rows in "sheet1" and puts them in sheets "NumbersX" where "X" is 1-10.

The enclosed file dated 2-2020 has had changes to the numbers in B10:AG17. B18:AG18 remains the same as in the original code.

After changing the numbers in B10:AG17, Running the code presents error "Error #13 Type mismatch". But the code seems to run as intended.

What I would like to know is:

1) why the error? and
2) does it affect the results of the code?
3) if results are not affected, what can I do to eliminate the error?
CreateCominationsFromGoups_2-2020.xlsm
0
In the attached file I'd like to keep the cell references the same despite the fact that I have to update the data in cells C2:H2.

To update I click inset a row which means the data moves down. When this happens the cell references increment one every time I add a row. That means instead of remaining "C2:G47" the cell references increment by one as shown in the formula below. The formulas  are in cells Q4:Y11.

=IFERROR(AGGREGATE(15,6,$C$3:$G$48/($C$3:$G$48>P4),1),"")

If it cannot be done with the formulas and data in same sheet.  I will need the code to use in the formula to reference from the new page to the data page.
KeepSameCellReferenceWhenMovingCell.xlsm
0
Hello,
I have an asp net page with separate VB code behind page.
The aspx page is about 2000 px long. There are is a top, middle, and lower sections.
I need to be able to jump to each section based on various events in my code behind.
I was thinking of putting a heading label for each section.  I would like a command that I could insert as needed in my code behind to jump to specific labels. It will need to work across desktop and mobile platforms.
Thanks,
WillieCg
0
Hi Experts,

This Q is related to the following.

Currently whenever the script encounters an invalid date it gives the attached error message.
Would like to have a message displaying the line# (of the data file) the this error occurred along with the invalid data.

Thanks
Capture1.PNG
0
The idea is to create unique combinations from the numbers in B11:AJ15.

The number sets are listed in B11:AJ15. I'd prefer a prompt to select the numbers as the sets may change.

1)  In order to so unique numbers must be identified. I have done this in AM11:AV17. The unique numbers in AM11:AV17 need not be used as this may create errors in the code.

2) to limit the number of combinations these should be limited as follows:

a)  each combination is made up of 5 unique numbers per set. An example =  1,3,11,12, 21
b)  no more than one sequential number per set. In the example above,11 and 12 are sequential, thus no other sequential numbers can appear.

c) limit of two numbers from same "deci". A deci is defined as: 1-9, 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70-79. For instance, where 11 and 12 appear 13 cannot. It would violate the deci rule.

The result should be a page of combinations. These pages should:

1) begin with the numbers in B3:L3. In other words the first page should be labeled "Number_3" and begin with the number 3 in B5. The next page should be labeled "Number_4" and begin with number 4 in B5, etc.

2) if the code is run again it should delete the prior pages created and should begin with numbers from B3:L3

The file Combinations Sheets contains the fields referred to above.

The file "Matched-And_Unmatched.xlsb" contains a sample script that makes pages but does not let me choose the numbers I wish to make combinations with. This is the…
0
My questuon is related to outlook.
I got 1000+ alias id and I need country data for this id. Is it possible to write VB script to pull out country data from alias id?

The manual procedure, put the alias ID in TO text field in write email screen and press CTRL +K and right click the name and select 'open outlook properties'  and then copy the country data.

My question is it possible to write API to outlook?
0
I have a scenario that I have to loop through values that are in a dynamic array or string.  Looking for some guidance in understand this.



AllTabs=SAPGuiSession("Session").SAPGuiWindow("Display Normal Order 200760677").SAPGuiTabStrip("TABSTRIP_CHAR").GetROProperty("allitems")

AllTabs output could be  "GR_01;GR_02;GR_03;SG_01;SG_02;SG_03;SG_04;SG_05;SG_06;SG_07;SG_08;SG_09;SG_10;SG_11;SG_12;SG_13;SG_14;SG_15;SG_16;SG_17;"

I am trying to loop thru the values starting with GR_01, and defining it as a var, like make it H = to whatever is in first position.

For i = 0 to ubound(AllTabsB)
            CurrentTab=SAPGuiSession("Session").SAPGuiWindow("Display Normal Order 200760677").SAPGuiTabStrip("TABSTRIP_CHAR").GetROProperty("selecteditem")
                  If CurrentTab = H Then
                  MsgBox "On right tab"
                        SAPGuiSession("Session").SAPGuiWindow("Display Normal Order 200760677").SAPGuiTabStrip("TABSTRIP_CHAR").Select i
                  Else
                  MsgBox "On WRONG tab"
                  End If
            Datatable.GetSheet("Results").AddParameter AddAdditionalResultParametersForFunction(i),""
      Next
0
Hi

We are using Windows 2012 Domain controller Windows 10 workstations.

I have 2 users and when they log into the Windows 10 PCs,  I would like a shared drive mapped on any PC they log into the network.
The shared derive is located on the windows 2102 server.

Please let me know the best way of doing this and any tutorials will be great.

Thanks
0
If using price in vb in visual studio what would you assign the variable? I did not see currency listed would I use int? Thanks
0
how to set a value to registry in Vb6
got a error on setting a value to registry syntax

  'Change the keyboard type and show it
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Handles Button6.Click
        'Change the Registry entry for the required keyboard
        My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\ComfortSoftware\hvk", "KeyboardName", "Name of your chosen keyboard")
        'Open the keyboard
        Dim hWnd As Integer
        hWnd = FindWindow("TFirstForm", "hvkFirstForm")
        Call PostMessage(hWnd, WM_CSKEYBOARD, 1, 0)
    End Sub
keybod-set.png
0
Hi

I am trying to do is use a control file to get into the correct folder. Open the file and run a macro and then save that file with the month end date.

I have been successful in opening the file and saving it with the month end date

However I have been unsuccessful in running the macro when I open the file.

2 files .
           1.Control file contains the projects numbers and their location
           2. Project Variance file

Macro in the control file loops through the number of rows based on project numbers. Goes to their corresponding folders opens the Project Variance file Project Variance Report.xlsm and runs the macro DisableUpdates then SAVE AS with end of the month date.

Sub test()

    Dim wk As String, yr As String
    Dim fname As String, fpath As String
    Dim owb As Workbook
    Dim fdObj As Object
    Dim fileName As String
    Dim x As Integer
    Dim NumRows As Integer
    Dim sMacroName As String
      
    
    sMacroName = "'!DisableUpdates"

   ' With Application
    '    .DisplayAlerts = False
     '   .ScreenUpdating = False
      '  .EnableEvents = False
   ' End With

    ' Set numrows = number of rows of data.
      NumRows = Range("A1", Range("A1").End(xlDown)).Rows.Count
      ' Select cell a1.
      'Range("A2").Select
      ' Establish "For" loop to loop "numrows" number of times.
    For x = 2 To NumRows
         ' Insert your code here.
         
         ' Selects cell down 1 row from active cell.
        

Open in new window

0
Hi Experts,

Looking for some expertise with this script.

Here is what the script does:

1) Reads from a text file with computer names and remotely runs a SCCM advertisement.

2) The advertisement opens some processes - which I have in a loop in this script.  

3) When the processes read 0 the loop is completed, then moves to the next command to RESTART the computer.

4) Is there any way to have this run 3 times, and then shutdown on the 3rd time?

$OutArray = @()
workflow foreachrerun {
    param([string[]]$computers)
    foreach –parallel ($computer in $computers) {
       InlineScript {
Function Start-CCMRerunAdvertisement {
    [CmdLetBinding()]Param(
        [Parameter(Mandatory=$true)][string]$computerName,
        [Parameter(Mandatory=$false)][string]$advertisementId = "*",
        [Parameter(Mandatory=$false)][string]$packageId = "*",
        [Parameter(Mandatory=$false)][int]$maxRun = 1
        #[Parameters(Mandatory=$false)][switch]$moreThanPing = $false
    )
    if($advertisementId -eq "*" -and $packageId -eq "*") {
        Write-Error "You must supply either an AdvertisementID or a PackageID"
        return "Missing Parameters"
        break
    }
    $searchString = "$advertisementId-$packageId-*" 
    if(!(Test-Connection -ComputerName $computername -ErrorAction SilentlyContinue)) {
        if($moreThanPing) { 
            if(!(Get-ChildItem "\\$computername\c$" -ErrorAction SilentlyContinue)) {
                Write-Error "System 

Open in new window

0
Hi,
Message was not sent properly (with HTML format). If it is not using HTML format below, everything is fine. Why?
Sub Send_email()
    On Error GoTo ErrHandler
    
    ' SET Outlook APPLICATION OBJECT.
    Dim objOutlook As Object
    Set objOutlook = CreateObject("Outlook.Application")
    
    ' CREATE EMAIL OBJECT.
    Dim objEmail As Object
    Set objEmail = objOutlook.CreateItem(olMailItem)

    With objEmail
        .to = "??@gmail.com"
        .Subject = "This is a test message on Jan 31"
        '.Body = "Hi there"
        '.Display        ' DISPLAY MESSAGE.
        .BodyFormat = olFormatHTML
        .HTMLBody = "<HTML><H2>The body of this message will appear in HTML.</H2><BODY> Please enter the message text here. </BODY></HTML>"
         .send
    End With
    
    ' CLEAR.
    Set objEmail = Nothing:    Set objOutlook = Nothing
        
ErrHandler:
    '
End Sub

Open in new window

0
I have  a VB script I'm using to perform a task that depends on the value of a registry key string value.  I need to query the key and find out if the contents of a string value (REG_SZ) equals ABC.

I already use a script that checks if a registry key exists and it works fine.  I can't seem to find any information on how to check if the contents of a registry key value equals ABC.  I need to check if the string contains ABC - like below.

HKEY_LOCAL_MACHINE\SOFTWARE\ESD\INFO\Program      REG_SZ    ABC  

This is what I have

REM @echo off

reg query HKEY_LOCAL_MACHINE\SOFTWARE\ESD\INFO /v Program REM >nul 2>&1

if %ERRORLEVEL% == 0 goto THERE
if %ERRORLEVEL% == 1 goto NOTTHERE

:THERE

echo APS is there.


:NOTTHERE

echo APS is not there!

Pause

Exit b/0

Open in new window


This tells me that Program exists but it doesn't test that the content of Program is ABC.

Any assistance would be appreciated.
0
Hello All;

As the title suggests, I have just installed SQL Server 2019 on my test system, in hopes that I can get it to accept the Case-insensitive and accent-sensitive characters like the example below.

Dvořák Hall

So far, when I insert these characters, I get a BIG Y from the >> řá <<

Table column information

The column is set to ( CHAR )
Collation = Latin1_General_100_BIN2_UTF8

In my web.config file, I have the following.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.web>
	<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

Open in new window


Any additional information would be wonderful.
0
I'm trying to attach a file to an email via vbscript and CDO.  
The error is "Wrong number of arguments or invalid property assignment: 'objCDO.AttachFile'"

              objCDO.AttachFile (rsEQUIPInvoices.Fields.Item("InvoiceFileLocation").Value)

value from recordset is exactly as:
              "D:\inetpub\Media\EQUIP_Invoices\2019\12\13\I_I_229406.pdf"

I think its the way I'm referencing the field, but I can't remember the proper syntax.
Please advise.
Mark


Set objCDO = Server.CreateObject("Cdonts.NewMail")
objCDO.BodyFormat =0 ' 0 is a plain text, 0 "zero" is a HTML
objCDO.MailFormat = 0 ' 1 is a plain text, 0 "zero" is mime format

objCDO.From = Request("varFrom")
objCDO.To = Request("varTo")

objCDO.Subject = "Invoices from Schmidt Equipment"
objCDO.Body = "Invoices from Schmidt Equipment"

While ((Repeat1__numRows <> 0) AND (NOT rsEQUIPInvoices.EOF))
      objCDO.AttachFile=(rsEQUIPInvoices.Fields.Item("InvoiceFileLocation").Value)
        Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsEQUIPInvoices.MoveNext()
Wend

objCDO.Send
Set objCDO = Nothing
0
I am trying to send an email with multiple attachments using CDONTS.
The code below sends the email, but never attaches anything.
I feel like I've got a vb script errror where I scroll through the record set rsEQUIPInvoicesAttach, which contains 2 records.
If I take that loop out of my code, I can manually create an email with multiple attachments, so I'm confident my CDO syntax is correct.

<% if (cStr(Request("Submit")) <> "") Then
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")
objCDO.From = Request("varFrom")
objCDO.To = Request("varTo")
objCDO.Subject = "Invoices from Schmidt Equipment"
objCDO.Body = "Invoices from Schmidt Equipment"

While ((Repeat6__numRows <> 0) AND (NOT rsEQUIPInvoicesAttach.EOF))
           objCDO.AttachFile "C:\test.txt"
          Repeat6__index=Repeat6__index+1
              Repeat6__numRows=Repeat6__numRows-1
        rsEQUIPInvoicesAttach.MoveNext
       Wend        
            
objCDO.Send()
Set objCDO = Nothing
Response.Redirect("/menu.asp")

End If
%>
0
Hello experts,

I have in a excel file:

-      A target value in C1
-      A table A4:D406
-      values for each row in column D. These values are sorted from lowest to greatest (so D4<D5<D6…)

I would like a macro that formats all the data in the range ‘An:Dn’ in ‘bold red’, with n being the row number where Dn<=C1

Thanks
0
Can I use visual basic for apps with mysql? I have worked with access and am new to mysql. In access I could code in vb to perform a task. I am not sure if I can do this in mysql.
0
I need to help creating a power shell script to /delete (i.e. bcdedit /delete {current}) the current bcd definition and restart the computer.. can somebody help me with this.....
1

VB Script

37K

Solutions

20K

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.