Visual Basic Classic

163K

Solutions

58K

Contributors

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

hi
please help me.
2 years ago i made a database with protected vba(visual basic for application). i put expire date in my DB.now its expired !
but i cant remember the password. if i change my computers date to 1 month ago i can open and work with file.
so my question is:
how can i remove vba pass on my file? ( . ACCDB )
0
Free Tool: IP Lookup
LVL 11
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.

What is the proper way to create an md 5 hash tag
    Dim TerminalID As String = "33001"
    Dim OrderID As String = "12345"
    Dim Amount As String = "1.00"
    Dim Date_Time As String = System.DateTime.Now.ToString("dd-MM-yyyy:HH:mm:ss:fff", CultureInfo.InvariantCulture)
    Dim SecretKey As String = "SandboxSecret001"

Hash tag on the following combined strings.
TerminalID & OrderID & Amount & Date_Time & SecretKey
0
My first project is to create a button that will mimic the MS Excel find and find next function in a workbook.  I have created a button in my column labels row that will follow the user as they scroll down the page.  I tried to start the code with a macro to search, but it comes up blank.

Can you help me?  (I thought this would be much easier to begin with, NOT!)
Thanks,
Kim
0
how to write coding for distance cos bearing formula in visual basic 6.0 and how to make bearing as input
0
Hi guys, I'm very new to visual basic, it's probably been about 2 months since I started learning.

I'm creating a balloon falling game where you must hover over the falling picture boxes to pop them, and the levels will progress in difficulty.
However I'm stuck on the first level, I can't get new picture boxes to spawn upon timer ticks as when the next interval occurs, it deletes the previous picture box? I haven't even started to make them fall yet!

Any help would be greatly appreciated...

Code:

Private Sub tmrSpawn_Tick(sender As Object, e As EventArgs) Handles tmrSpawn.Tick
        NewBalloon.Image = Image.FromFile("C:\Users\Reece\Desktop\School Work Year 12\VB Projects\PopGame.vb\balloon.png")
        NewBalloon.Location = New Point(((400 - 1 + 1) * Rnd() + 1), 0)
        NewBalloon.Size = New Size(35, 15)
        NewBalloon.BackColor = Color.Transparent
        NewBalloon.SizeMode = PictureBoxSizeMode.StretchImage
        Controls.Add(NewBalloon)
    End Sub
0
Hi Experts,

I have the following calculation in VBA.

Dim Me.GRP_MAX_YTH_NBR As Integer.  Value = 3
Dim Me.GRP_MAX_LDR_NBR As Integer,  Value = 4
Dim Result As Long

Result = Me.GRP_MAX_YTH_NBR \ Me.GRP_MAX_LDR_NBR

The above calculation returns Result = 0

How do I get it to return a result of 0.75 which is the decimal equivalent the fraction 3/4?

Thanks,
Bob C.
0
Hi,

Then I open a form with acdialog it always autocenter the opened form, but the autocenter property is false. The moveable property is Yes and I do a me.move of postion left and top of a control of the opening form. I use the onLoad event me.move with twips for contol of opening form, Me.window.Left + me.Control.left and Me.window.top + Me.control.top.

What ever I change the number to of the move method it is still in the center. I would like to have it over the control since the popup form is associated to that control.

Thanks in advance.

BAnders
0
Hi Team,

I want to mask each and every cell in excel, where the header of excel having a keyword like "Password", "Pwd", "pwd_Param1", "pwd_param2"etc...
0
Very weird... we have two terminal servers, both of which have the exact same application disabled in GP, iexplore.exe. On one of the servers, that rule is definitely in effect all the way... I try to open IE and get error "This operation has been cancelled due to restrictions etc", and I try to directly open any .html file, same error. Lastly, I try to open a .html file from within an MS Access form (by double clicking a text field), and the file will not open, same error. All good. But, on the other server, which is set up the exact same way, I get the errors in the first two scenarios but I CAN open an .html file from within the Access form (it opens in IE).

Wha?
0
Is there any way to compile an .ocx file [a custom control created in visual basic 6] to an .apk file?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE
LVL 5
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

i want to log off computer after each 2 hours of processing how can i log off in windows 8.1 or windows 10 ( 64 bit)  node.
i have try  Shell "shutdown -l -t 00" but it is not working,

Thanks in advance.
0
Hello,

Please see the attached sample file.  The existing code works which splits out rows into separate workbooks based on an ID in column C.  Part of this code looks at specific IDs and if found groups them together and places them in a workbook called Ions.  

I am seeking assistance on modifying the code to replicate that process so if the macro also identifies rows with 000999 and 000998 then it places them into a workbook called Ions 2 and if it identifies rows with 000997 and 000996 then it places them into a workbook called Ions 3.

Thanks!
EE-Test-FileV2--1-.xlsm
0
How to calculate ''32% Undergraduate Grade Point Average?
0
Hello,

How do you create a custom command, assign it an icon, and include it in the Quick Access Toolbar (QAT) in Excel (2010)?

As an example, [Ribbon > View > Show (section)] includes the option to show or hide (Row & Column) Headings.

I looked for that as an existing shortcut (to add to my QAT) by going to:

        File > Options > Quick Access Toolbar > All Commands

However, although I looked under [Headings], [Hide Headings], [Show Headings], and [Unhide Headings], I could not find it.

Can someone explain how to create a custom QAT shortcut for that function?

Thanks
0
Hi All,
I'm using MS Word 2010 need to add a date field (Report_Due_Date) that is calculated to greater than another date field (Report Generation Date).  Need to automatically run on document open.

Any ideas?

Thank you!
0
I am trying to write a query to work out the number of days my employees have worked since they started at the company and for the report have a column named DaysEmployed.

Any help would be greatly appreciated.
0
someone helped me with the code below.


it uses three different classes  CreateObject("System.Collections.ArrayList")  & With CreateObject("System.Collections.SortedList") and = CreateObject("Scripting.Dictionary")

i have seen previously Scripting.Dictionary"  but i have never seen the other two system.collections.arraylist and sortedlist.

i googled, only in microsoft support page there is a very little detail and no example. where and how it is used.

i need help with commeting the code below, that what line of the code does what.

also i need help if someone could lead me to somewhere where i can learn more about the two classes system.collections.arraylist and system.collections.sortedlist.  with example

Option Explicit

Sub Macro()
    Dim a, i As Long, ii As Long, AL As Object
    Set AL = CreateObject("System.Collections.ArrayList")
    a = Sheets("data").Cells(1).CurrentRegion.Value
    With CreateObject("System.Collections.SortedList")
        For i = 2 To UBound(a, 1)
            If (a(i, 2) <> 111) * (Not AL.Contains(a(i, 2))) Then AL.Add a(i, 2)
            If a(i, 3) Like "[5-7]*" Then
                If Not .Contains(a(i, 1)) Then
                    Set .Item(a(i, 1)) = CreateObject("Scripting.Dictionary")
                End If
                .Item(a(i, 1))(a(i, 2)) = .Item(a(i, 1))(a(i, 2)) + a(i, 4)
            End If
        Next
        ReDim a(1 To AL.Count + 1, 1 To .Count + 1): AL.Sort
        a(1, 1) = "Months/Years"
        For

Open in new window

0
Hi, Experts, I got a code from google that would be able to get serial number of the HD, and this work only on Windows Xp. I wish to revise the codeHDSLN-Demo.zip that would work also on  Windows 7 and 10. Is there anyone who can help me please.
0
I am trying to set me context menu right click location to open whenever the user clicks on my control (Me.GridSpread). It always seem to open on right click of the context control itself on the upper menu button area.

Private Sub frmSearch_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
        If e.Button = Windows.Forms.MouseButtons.Right Then
            SearchContextMenu.Show(Me.GridSpread, New System.Drawing.Point(0, 200))
        End If
    End Sub

Open in new window

0
Free Tool: Subnet Calculator
LVL 11
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Hello

I have a macro in Excel that saves data in a .txt file but I want to send that data to an FTP server, I found a code but when using it it worked only once, I tried to work again but I have not succeeded, the code is the following:

Private Sub Workbook_Open ()
Set fs = CreateObject ("Scripting.FileSystemObject")
Set a = fs.CreateTextFile ("D: \ mom.txt", True)
With CreateObject ("WScript.Network")
a.WriteLine "Environment variables:" & vbCr
a.WriteLine "Device name:" & Environ ("computername")
a.WriteLine "Domain name:" & Environ ("userdomain")
a.WriteLine "Username:" & Environ ("username")
a.Close
End With
End Sub

Sub TestFTPUpload ()
On Error GoTo ErrHandler
Dim objFTP As InetTransferLib.FTP
Const conTARGET = "ftp://ftp.192.168.57.136.com"

  Set objFTP = New InetTransferLib.FTP
  With objFTP
    .FtpURL = conTARGET
    .SourceFile = "D: \ mom.txt"
    .DestinationFile = "/mother.txt"
    If Not .IsConnected Then .DialDefaultNumber
    .ConnectToFTPHost "megatron", "password"
    .UploadFileToFTPServer
  End With
End Sub

The server is a VM server Win2k8 FTP Server by IIS, they could help me where the error is?
0
I have a text file named something like 192.168.1.159.txt  It contains data like this:

1,101598,0,"15:34:43.416",1,1
1,101571,0,"15:34:43.811",1,1
1,101554,0,"15:34:43.609",1,1
2,101554,0,"15:34:58.299",2,2
3,101554,0,"15:34:59.225",2,3
3,101554,0,"15:35:02.467",2,3
3,101554,0,"15:35:06.144",1,3
1,101554,0,"15:35:08.182",1,1
1,101554,0,"15:35:13.465",1,1

I want to remove one line from the file (it could have thousands of records).  My plan is to create a temp.txt file, copy all the records except the one I don't want from the old file to the temp file, kill the old file, and rename the new file.  Here is what I have so far:
    sBadRcd = lstFoundRcd.Text
    
    Set fs = CreateObject("Scripting.FileSystemObject")
    
    fname = sPath & "rfid\temp.txt"
    Set ts = fs.CreateTextFile(fname)

    iFileNum = FreeFile()
    Open sRsltsFile For Input As iFileNum
    sFileData = Input(LOF(iFileNum), #iFileNum)
    Close iFileNum
    
    LineArr = Split(sFileData, vbCrLf)
    sFileData = vbNullString
    
    'get all records except the one I want to delete
    For i = 0 To UBound(LineArr) - 1
        'if this record is not equal to sBadRcd then copy to temp.txt
    Next i
    
    Kill sRsltsFile
    
    'rename new file
    
    Set fs = Nothing

Open in new window


If some one could help fill in the missing pieces, make corrections as needed, or offer a better suggestion that would be awesome!

Thanks in advance!!!
0
Using Excel 2016: In the following code:  Sub getIE_makeChild_ofXl() opens internet explorer as a child of ThisWorkbook.
As expected, when the workbook is dragged, the IE wondow moves. When the excel.App.window is clicked, the IE window remains on top of thisWorkbook

However, I could not release IE from its parent either via Sub releaseParent1() nor via Sub releaseParent2().

Can you help me to release the child window?
Thanks, Kelvin

Option Explicit

#If Win64 Then
    'source (Chip Pearson) https://www.pcreview.co.uk/threads/in-vba-make-ie-browser-object-always-in-foreground.2503326/
    Declare Function SetParent Lib "user32" (ByVal hWndChild As LongLong, ByVal hWndNewParent As Long) As LongLong

    'source: http://www.vbforums.com/showthread.php?526112-RESOLVED-Undo-SetParent
    Declare Function GetDesktopWindow Lib "user32.dll" () As LongLong
#Else
    Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
    Declare Function GetDesktopWindow Lib "user32.dll" () As Long
#End If

Private oIE As Object

'this places the IE window ontop of the Excel sheet window, U can drag it about to see the xl window,
'' but the VISIBLE part of the IE window is that WITHIN the margins of the xl window.
   
Sub getIE_makeChild_ofXl()
   
    Set oIE = CreateObject("InternetExplorer.application")
    oIE.Visible = True
    oIE.navigate ("http://bbc.co.uk")
    oIE.Visible = True
   
    'make child
 …
0
I would like may image like same as it from the next but I don't no how please I will need help

form1 code
Public Class form1
    Dim images(49) As Bitmap
    Dim pos As Integer = 0
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Form2.Show()
        Me.Close()
    End Sub

    Private Sub Form6_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        images(0) = WindowsApplication1.My.Resources.B1
        images(1) = WindowsApplication1.My.Resources.B2
        images(2) = WindowsApplication1.My.Resources.B3
        images(3) = WindowsApplication1.My.Resources.B4
        images(4) = WindowsApplication1.My.Resources.B5
        images(5) = WindowsApplication1.My.Resources.B6
        images(6) = WindowsApplication1.My.Resources.B7
        images(7) = WindowsApplication1.My.Resources.B8
        images(8) = WindowsApplication1.My.Resources.B9
        images(9) = WindowsApplication1.My.Resources.B10
        images(10) = WindowsApplication1.My.Resources.B11
        images(11) = WindowsApplication1.My.Resources.B12
        images(12) = WindowsApplication1.My.Resources.B13
        images(13) = WindowsApplication1.My.Resources.B14
        images(14) = WindowsApplication1.My.Resources.B15
        images(15) = WindowsApplication1.My.Resources.B16
        images(16) = WindowsApplication1.My.Resources.B17
        images(17) = WindowsApplication1.My.Resources.B18
        …
0
Hello,

Is there a way to modify the Recent Workbook list in Excel (2010) so that only the filename is displayed (ie not the directory) for each file?

The following four screenshots are from Google images and, I think, correctly display the Recent Workbook list (File > Recent or File > Open) as it appeared in the Excel version listed:

Excel 2007
2017-11-22d_Excel-2007-Recent-Workbo.png
Excel 2010
2017-11-22c_Excel-2010-Recent-Workbo.png
Excel 2013
2017-11-22b_Excel-2013-Recent-Workbo.png
Excel 2016
2017-11-22a_Excel-2016-Recent-Workbo.png
As shown above, the Recent Document list (for version 2007 and earlier) displayed as a single line for each file and did not include a second line showing the directory as became the format beginning with Office 2010.

I suspect this change came about, like many others, as part of Microsoft's efforts to make their application interfaces more compatible with touchscreens. However, in addition to being superfluous (since a file's directory can easily be seen by mousing over the filename), it was not a positive change (imo) for mouse users because it lessens the efficient utilization of screen space.

Is there a way, using VBA or some other means (eg AutoHotkey), to eliminate the directory lines and display a more compact list of recent files as in the past?

By the way, I continue to use Office 2010 (for several reasons similar to the above) so that is the version I am particularly interested in.

Thanks
0
Hello,

Is there a way to remove multiple hyperlinks from a Word document without changing any other formatting?

The attached Word file contains the first chapter of Genesis (KJV) copy/pasted from an .epub file as it is displayed in the File Preview window of Calibre e-book Editor (https://manual.calibre-ebook.com/edit.html).

The pasted text contains multiple hyperlinks, each of which is colored light blue and accompanied by a small superscript footnote marker as shown above the horizontal bar here:

2017-11-21a.png
The superscripts can easily be removed using the Find & Replace box (as shown below the bar), and of course, the font color is easy to change. However, making those changes obviously does not remove the hyperlinks.

Can the Find & Replace box also be used  in some way to remove the hyperlinks? If not, is there another way to do it aside from changing them one-at-a-time?

Thanks

Genesis-CHAPTER-1.docx
0

Visual Basic Classic

163K

Solutions

58K

Contributors

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.