Visual Basic Classic





Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

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

Sign up to Post

Using Visual Basic 6 on the Windows 10 pro version 1809 I would like to automatically unmute the volume and set the volume level to 100% of the pc.

I tried this post only to not have any error messages but did it did not work either:
I tried the above post for the unmute with the registry for the master mute found here:
However it doesn't seem to change when it's muted or unmuted.  It stays at 00 00 00 00
Private Sub Command1_Click()
Dim WSHShell, regkey, regval
Set WSHShell = CreateObject("WScript.Shell")
regkey = "HKLM\System\CurrentControlSet\Control\MediaCategories\{185FEDE4-9905-11D1-95A9-00C04FB925D3}\Display"
regval = WSHShell.RegRead(regkey)
If regval(0) = 1 Then
MsgBox "muted"
MsgBox "NOT muted"
End If
End Sub

The below works but does not adjust the original volume settings but rather uses it as the starting volume (max).  Also the mute/unmute does not work.

I am also using on board audio only (no speakers or headphones attached)

Or if someone could please tell me where, in the registry the volume level and status (mute/mute) …
Ensure Business Longevity with As-A-Service
Ensure Business Longevity with As-A-Service

Using the as-a-service approach for your business model allows you to grow your revenue stream with new practice areas, without forcing you to part ways with existing clients just because they don’t fit the mold of your new service offerings.

export crystal report to pdf from vb6
Hi Experts,  I copied a code from net and the code is able to obtain Hard Drive Serial number in Windows 10 but not in Windows Xp. Is there anyone who can help me using the code below to get the HDD S/N in Windows Xp? Any help please... thanks!

Private Sub Command2_Click()
'Do not disAble
Dim oWMI As Object
Dim sComputer As String
Dim oItems As Object
Dim oItem As Object
'your Computer
sComputer = "."
' WMI-Objekt
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
  & sComputer & "\root\cimv2")
' WMI-query
Set oItems = oWMI.ExecQuery("Select * from Win32_DiskDrive")
For Each oItem In oItems
  On Error Resume Next
  List1.AddItem "Index: " & oItem.Index
  List1.AddItem "InterfaceType: " & oItem.InterfaceType
  List1.AddItem "DeviceID: " & oItem.DeviceID
  List1.AddItem "Model: " & oItem.Model

 List1.AddItem "SerialNo: " & oItem.SerialNumber
  List1.AddItem "-------------------------------------" & vbCrLf
  On Error GoTo 0
Set oItem = Nothing
Set oItems = Nothing
Set oWMI = Nothing
End Sub

Open in new window

I want to continuously searching all files base on the code below. The code below will stop once it found the item. How to improve the code to  let the searching search the entire drive. Thank you!

Option Explicit
Private Declare Function SearchTreeForFile Lib "imagehlp" (ByVal RootPath As String, ByVal _
InputPathName As String, ByVal OutputPathBuffer As String) As Long
Private Const MAX_PATH = 260

Private Sub Command2_Click()
    Dim strPadPath As String
    Dim lngAmIHere As Long
    'create a buffer string
    strPadPath = String(MAX_PATH, 0)
    'Typically, lngAmIHere will return 1 if successfull, 0 if not
    lngAmIHere = SearchTreeForFile("C:\Program Files\WebPrinterActivator\", "WebPrint.exe", strPadPath)
    'MsgBox Trim(strPadPath)
    If lngAmIHere <> 0 Then
        'MsgBox "Located file at " + Left$(strPadPath, InStr(1, strPadPath, Chr$(0)) - 1)
        MsgBox "Found!"
        MsgBox "Not found!"
    End If
End Sub
See environment below

Need VBA running in either Access (preferred) or excel which will add/delete a user to a sharepoint group and also list all members of a group into a table or excel sheet.

I've tried the OData approach for getting all users but unsure how to get it working in Access.

Environment: SharePoint 2013 - onprem, full control only (no SCA), and no farm access (no powershell).

VBA examples sought - not C##, powershell, ...
Hello, All.

OK, what used to work, no longer work.
A multiple row insert, will now only, insert all into a single field.

environment: Windows 10 Pro / IIS
inserting into a Microsoft Office Access Database ACCDB
(This is a site for the intranet, and not for the internet. Which is the reason for using the access database)

Code, that used to work.

The form has all TEXTAREA's that are feeding into the insert form.

arrMN = Split(Request.Form("MediaName"), vbCrLf)  
arrMF = Split(Request.Form("MediaFile"), vbCrLf)  
arrMB = Split(Request.Form("MediaBand"), vbCrLf)  
for i=0 to uBound(arrMN)
  Set objDoubleInsert=CreateObject("ADODB.Command")  
  objDoubleInsert.CommandText = "INSERT INTO EVMediaServer (MediaName, MediaFile, MediaBand) VALUES (?,?,?)"  
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaName", 200, 1, 255, arrMN(i)) 
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaFile", 200, 1, 255, arrMF(i))  
  objDoubleInsert.Parameters.Append objDoubleInsert.CreateParameter("@MediaBand", 200, 1, 255, arrMB(i))  

Open in new window

before, this code used to create as many rows as I had in the fields.
But now, all of it is inserted into ONE ROW, and all the lines are in one column.

What is going on?
Thanks for any and all assistance on this one.

I created the following code to open an Excel file and select a particular sheet based on the Property Code that was previously copied into the clipboard.  HOWEVER, it stay minimized and blinking on my bottom toolbar.  I googled and try adding the 3 lines starting with Set MyObj=CreateObject("WScript.Shell, but that had no effect.  Any suggestions to bring it to the forefront and maximized.  Note, I start the whole process from a button in a Filemaker dbase layout so Filemaker is in the forefront and unfortunately remains there.  Thank you.

Dim xlApp, xlWb

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWb = xlApp.Workbooks.Open("N:\EXCEL\Files\SHARED TOOLS\Sales Reports\SALES REPORTS.xlsm")

xlApp.Run "'" & xlWb.Name & "'!SelectSheet"

Set MyObj=CreateObject("WScript.Shell")
myobj.appactivate "Microsoft Excel"
set myobj = nothing

'if the macro takes arguments, use:
'xlApp.Run "'" & xlWb.Name & "'!NameOfMacro", "Arg1", "Arg2", "Arg3"

'xlWb.Close True
Set xlWb = Nothing
Set xlApp = Nothing
From the reading pane of Outlook, I would like to quickly copy the contents (body and header) of a highlighted email messages to be able to paste into a work order system.

Is there a way to do this with Quick Steps or would I need a macro?

I can semi-manually do this by hitting Reply then CTRL+A and erasing my signature at the top of the reply, but it gets tedious.
If there is a way to reply without Signature when using the macro/quick step (without changing my signature preferences), that would be ideal.

I am a newbie with VB6 and Crystal, so I apologize for my simple question.

I am trying to integrate VB6 and Crystal 11.5 and I can do everything I want if I use the Access db.  We are now switching to SQL db and I can get the reports to work fine on the Dev machine, but not on the Deployed Computers.
Is there a tool to use to tell me what control or dll is missing?

I am using RDC with ADO and I keep getting a 429 error Axtivex cannot create object.
I've registered all the dlls that I know of.

Dim crxApplication As New CRAXDRT.Application
Public Report As New CRAXDRT.Report

 ConnectionString = "Provider=SQLOLEDB.1;DSN=" & SQLServerName & ";" & "Password=" & SQLPassword & ";Persist Security Info=True;User ID=" & SQLUsername & ";Initial Catalog=LimitlessDailyTransactions;Data Source=" & SQLServerName
            ConnectionString2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DB & ";Persist Security Info=False"
            Adodc1.ConnectionString = ConnectionString
            Adodc2.ConnectionString = ConnectionString2
            Adodc1.Refresh 'sql DailyTransactions
            Adodc2.Refresh  'xl.mdb
            Set Report = crxApplication.OpenReport(DatabaseFolderLocation & ReportName)
            Report.Database.Tables.Item(1).SetDataSource Adodc1.Recordset, 3
            If BolSingleTable = True Then
                Report.Database.Tables.Item(2).SetDataSource Adodc2.Recordset, 3
From VB6 any code for create a self extracting zip exe???

In planet-source-code are this code:

But is lost the code... Any have how create a self extrancting zip from a programa created by vb6?
Exploring SQL Server 2016: Fundamentals
LVL 13
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

I have been puzzled by a visual basic program 6 that runs outside of autocad 2007 that I wrote, and that works on all of my computers except my home computer.

I uploaded the visual basic file and the sample autocad 2007 file.  The VB6 file should create a new line in the drawing file - but it fails on a line of code.  It works fine on our office computers!
It's 20 years dead, but I'm still learning it... just created my first DLL (needless to say I'm not a programmer... well maybe an Amateur programmer which is a "promotion" from what I used to say).

This DLL has a variety of string functions I created that I would like to make more easily referenced.  Right now, I add the reference in the project and then I have to "Dim MyDLL As New MyDLLs.ClassModuleName" which is generally fine... but now, if I want to apply one of my DLLs functions to a string, I have to do something like:

ThisString = MyDLLs.InvertCase(ThisString)

I'd like to be able to reference it with

ThisString = InvertCase(ThisString)

Basically treating the InvertCase function as a "local" function

Is this possible?  On one hand I can see it not being so, but I'm hoping...

Also, on a related note, I was thinking about putting SQL statements as constants into a DLL - does that make sense?  The idea being that I could have MYSQL.DLL and MSSQL.DLL where the MySQL version of the SQL statements was stored and MYSQL.DLL and the Transact-SQL statements were stored in the MSSQL version... problem is, the DLLs would have to be loaded conditionally - if using a MySQL database, load MYSQL, for example.  Though I suppose if I DIM SQLs As New MySQL vs DIM SQLs AS New MSSQL I could then reference SQLs.Statements.GetUsers?

(Haven't tried it with constants so it might not even work...)
My visual basic program that operates on an open autocad 200 drawing throws an error when I try to create a light weight polyline.  

I am debugging the program right now but cant get past this error - any help is appreciated.

*** Edit by Scott Fell, EE Moderator;  Files and note below from the Author ***
Uploaded a test Autocad 2007 file (Test_Drawing_v_2007.dwg), then three files comprising a visual basic 6 program, (Test_) ;RGM.vbp, RGM.frx, RGM.frm.

On my home computer the program will not create the LWPolyline - but it will work on my other computers - same base setups.

.. Any hints on a solution gratefully accepted ...
why do I not get all the data when I run these ZPL commands in vb6

Private Sub Command5_Click()
Printer.Print "^XA"
Printer.Print "^FO100,100"
Printer.Print "^BXN,6,200"
Printer.Print "^XZ"
End Sub

Open in new window

but if I use notepad with just the zpl and a generic text driver it prints all the data in the 2d barcode
I migrated vb6 to using the vs2008 wizard and it works fine But some controls are not visible on form.
 I can see them on control list in properties window but can not get them to be seen on the form in design time.
what am I missing?...
I'm trying to reduce the usage of Global variables in a rather large VB6 program.  Fabrice Lambert suggested using the Services Locator design pattern to access various dictionaries (or collections) instead of having a global dictionary.  This works great.  I have a factory class which has various support functions and properties which are used in many places in the program.  How can I use the factory functions without having a global object for the factory.  I can put a factory object in each procedure where it is used, but that seems like it will have a major impact on performance.
Private Sub ProcedureA
Dim oFactory as clsFactory
Dim myLongValue as Long
Set oFactory = new clsFactory
myLongValue = ofactory.LongValue
set ofactory = Nothing
End Sub

Open in new window

Any thoughts on this.  A global Factory object seems like the way to go, but OOP doesn't like global variables.
I have a 10 year old Access function that logs into a website and navigates to a search form and downloads data. However, the website has now changed and the function is useless. This site helped me create the code that has worked for many years. Basically I need help again. Unfortunately, I have forgotten many of the key points to the design of this function.

I am getting a
Run-Time Error '2147467259 (80004005)':
Method Busy of Object Webbrowser2 failed

In the past the browser would open the target page and enter my user name and password and login to the site. Currently, this is where the step is failing. Private Sub Command155 is where users would input their username, Pass word and date range that would be applied later in the procedure.

Private Sub Command155_Click()
'Assign the user inputs to variables that will be used in the Web application.
'Tell VBA what to do when the user does not input a date format
On Error GoTo NotADate

    myStartDate = Format(CDate(txt_StartDate), "mm/dd/yyyy")
    myEndDate = Format(CDate(txt_EndDate), "mm/dd/yyyy")
    myNAMC = txt_NAMC
    myUserName = txt_UserName
    myPassWord = txt_Password

    'Inform the user that this program is operating correctly.
    'MsgBox "Please wait, SKPI is updating!"
    ' I am just testing my variables here, this will be eliminated later.
    MsgBox "Start Date:" & " " & (myStartDate) & "   " & "End Date:" & " " & (myEndDate)

Open in new window

Lookup Error when search value is not foundDrop Down LookupHi,

  In my  ACCESS database, I have a table where I store company names and passwords.
 and form where I have two records - "AAA" and "CBS" . When searching for the record, if I enter non-matching value, then I get an error.
  Getting an error is ok, but it does not have what I call "graceful exit".
  For example, if I am typing "ab" and press [enter], I get an error message (as seen in the screenshot).
  What kind of visual basic code can I use to provide a graceful exit?

How do I convert these properties and such from vb6 to or c# prefably. Thank you.

Public Property Let Confirmed(Index As Integer, bConfirmed As Boolean)
    If bConfirmed Then
        sTransferOrder_Items(Index, GI_CONF_TO_ITEM_CONFIRMED) = vbChecked
        sTransferOrder_Items(Index, GI_CONF_TO_ITEM_CONFIRMED) = vbUnchecked
    End If
End Property
Public Property Get Confirmed(Index As Integer) As Boolean
    Confirmed = (sTransferOrder_Items(Index, GI_CONF_TO_ITEM_CONFIRMED) = vbChecked)
End Property
Active Protection takes the fight to cryptojacking
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

Hi Experts,
we have a site created in Caspio that has some required fields.
We realized that some of the required fields are coming thru w/o containing data.
So were told by Caspio that is probably due to those users using an old browser.
They created a field named user_agent that will capture which browser were used for each record data entry.
Now I created a list of all records with missing data in required field along with the data captured in this field named user_agent (browser).
See attached.
Wondering what are those values are and how can we sent a message informing this and this browser is not supported...
Hi Experts,

I have attached a VB Utility being regularly used by me. It is used to prepare some returns, where we input the data and the output is produced in the shape of some encrypted file format for onward submission. But it can also be used to prepare a correction return also. In that case we need to import a Consolidated file and then the return can be amended or extended.

What I presently do
--Download all the conso files

--Import the files one by one in above software.
>>Here we need to Select Form No (24Q / 26Q / 27Q / 27EQ).
>>Type of statement to be prepared is always "Correction".
>>Option to be selected "Import Consolidated File"

--Copy the data from the tabs and paste them in different sheets of Excel (Normally there are 3 Tabs, but data from 1st Tab is never copy pasted. There may be 4 tabs for the 24Q - 4th Quarter of a Financial year in which case the last 3 tabs are copy pasted)

Name of Tabs (from which data to be copied and pasted in Excel) in case of each Form
24Q >  Challan , Annexure I        (in case of 4th Quarter of FY tabs to be Copy pasted are Challan, Annexure I and Annexure II
26Q >  Challan , Annexure I
27Q >  Challan , Annexure I
2EEQ >Challan , Annexure I

Challan Data can be pasted in the same Excel Sheet for All Form Types, whereas for Annexure I and Annexure II, we need separate sheets for Each Form.

I wish some script (or anything like that even if that is in Excel) which can

I am running into quite an unusual problem and was wondering if anyone has experienced this issue before. I have an ActiveX Control that I have made that uses a Picture Box and displays an image from Azure blob storage by converting that image's memory stream into an image. I use this ActiveX Control for a Microsoft Access 2002 application. This ActiveX Control works great on forms, but on reports it doesn't display fully (Please see attached images). Anyone know why?
In my application, i have a common dialog component, on click of this component a dialog box will open where i can select a file and open it to get the list of account names that are there in the file.

The component was working fine, but from few days, when i click on this component my application is getting closed.

can somebody help me on this!!!!

Note: I have component added in my project. and the file is also present.
I had this question after viewing Failed to activate control vb.UserControl.
I have a similar problem and I know it is caused by two seemingly incompatible programs.
If I reinstall the app which reported the problem, the other one stops working and vice versa.
How can I get both apps to work in peace ?
How to create push message app for LAN in winform app like

Visual Basic Classic





Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.