How to make userform in Excel VBA remember password when 'red x' is pressed

How to make userform in Excel VBA remember password when 'red x' is pressed

Content Index :

How to make userform in Excel VBA remember password when 'red x' is pressed
Tag : vba , By : toki
Date : December 01 2020, 05:00 PM

To fix this issue I have a userform that calls a function with username/password prompt. , You can redirect the X to run the cancel button code instead:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    If CloseMode = vbFormControlMenu Then
        Cancel = True
    End If
End Sub

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How can I password protect an Excel UserForm but allow it to be reopened without the password?

Tag : excel , By : user121501
Date : March 29 2020, 07:55 AM
around this issue To password protect this panel, you just need to add some code that checks to see if the user entered the correct password. This is pretty simple using an InputBox and a conditional.
Sub macShowDevPanel()
    ' Source: http://www.excel-easy.com/vba/examples/protect-macro.html
    Dim password as String

    Select Case password
        Case Is = False
            ' do nothing
        Case Is = "CTM"
        Case Else
            MsgBox ("Incorrect Password")
    End Select

End Sub
Public password as String

Sub macShowDevPanel()

    If password <> "CTM" Then
        password = Application.InputBox("Enter the Dev Panel password", "Dev Panel - Password Protected")
    End If

    Select Case password
        Case Is = "CTM"
        Case Else
            MsgBox ("Incorrect Password")
    End Select

End Sub

How to make my UserForm code change the output cell of the code every time I run said UserForm in Excel

Tag : excel , By : new Blackberry devel
Date : March 29 2020, 07:55 AM
seems to work fine I must have misunderstood your question. Instead of the "last used row" you need to find the last row in column "C" that has a shape in it. This changed code will find the last row with a shape in column C, then it will add 2 rows to that number, and then place the image two rows beneath the lowest one. You can change those rows to however many you need. You might get an error if there are no shapes on the sheet when this is run. If so then you will have to create an error capture for that.
Private Sub CommandButton4_Click()

Dim ws As Worksheet
Dim ImgPath As String
Dim W As Double, H As Double
Dim L As Long, T As Long
Dim myArr() As Variant, myArrCounter As Long
Dim newRowNumb As Long

Set ws = ThisWorkbook.Sheets("Mobile POS Log Sheet")

'////////////////////////////////////////   This section will find the row of the bottom most shape in Column C
ReDim myArr(1 To 1)
myArrCounter = 0

For Each wshape In ws.Shapes
    myArrCounter = myArrCounter + 1
    If myArrCounter = 1 And wshape.TopLeftCell.Column = 3 Then
        myArr(myArrCounter) = wshape.TopLeftCell.row
        If wshape.TopLeftCell.Column = 3 And wshape.TopLeftCell.row > myArr(UBound(myArr)) Then
            ReDim Preserve myArr(1 To myArrCounter)
            myArr(myArrCounter) = wshape.TopLeftCell.row
        End If
    End If
Next wshape
newRowNumb = myArr(UBound(myArr)) + 2 ' this adds two rows to place the new picure.  Change the "2" to how many rows you need

'~~> This is my current pic file path
ImgPath = "C:\Users\raphaelo\Downloads\test.gif"

    With ws
        W = 30                  '<~~ Width
        H = 11                  '<~~ Height
        L = .Range("c" & newRowNumb).Left   '<~~ This is what should be changing each time I run the command
        T = .Range("c" & newRowNumb).Top    '<~~ This is what should be changing each time I run the command
         '<~~ Both the L and T Range entries should change to the next cell (C3 to C4 to C5 and so on) One digit up every time I run the Command Code
         '<~~ Unless it's the Placement entry below?
        With .Pictures.Insert(ImgPath)
            With .ShapeRange
                .LockAspectRatio = msoTrue
                .Width = W
                .Height = H
            End With
            .Left = L
            .Top = T
            .Placement = 1 '<~~ Not sure if this is the one that should change one digit up each time I run the Command instead?
        End With
    End With

End Sub

Excel VBA - Remember SQL ODBC User/Password

Tag : sql , By : nd27182
Date : March 29 2020, 07:55 AM
I hope this helps . I managed to ask the password from the standard window with this code:

Excel VBA Userform login with username and password on server

Tag : excel , By : user119413
Date : March 29 2020, 07:55 AM
it helps some times To help you with the obtaining the usernames and passwords part:
You could use the text to columns functionality in Excel to split into two columns and then loop those. However, I would read the CSV column A info into an array and then loop the array. Use the Split function with delimiter ";" to generate your pairs, assign the values from the split to password and username variables and then use those for your testing.
Option Explicit
Public Sub test()
    Dim ws As Worksheet, loginDetails(), currentLogin As Long, pairs() As String, lastRow As Long
    Set ws = Workbooks("name of CSV").Worksheets("Sheet1")   '<==change this to the open CSV name
    Dim pword As String, username As String
    With ws
        lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
        If lastRow = 1 Then                      '<change to 2 if header present
            ReDim loginDetails(1, 1): loginDetails(1, 1) = .Range("A1").Value '<= change this to A2 if header
            loginDetails = .Range("A1:A" & .Cells(.Rows.Count, "A").End(xlUp).Row).Value 'Change to A2: if header present
        End If
        For currentLogin = LBound(loginDetails, 1) To UBound(loginDetails, 1)
            pword = vbNullString: username = vbNullString
            If InStr(loginDetails(currentLogin, 1), ";") > 0 Then
                pairs = Split(loginDetails(currentLogin, 1), ";")
                username = pairs(0)
                pword = pairs(1)
                'Debug.Print username, pword
                'other code to test login

            End If
    End With
End Sub

Input username and password for SQL Server from userform VBA Excel

Tag : sql , By : Sandeep Arneja
Date : October 02 2020, 05:00 PM
wish helps you I want to input username and password SQL Server from userform VBA Excel, but I don't understand how to do that. So I create code like this: , You need single quotes around the strings like this:
cnn.ConnectionString = "Provider=SQLOLEDB;Data Source=;Initial Catalog=bank;User ID='" & txtUser.Text & "';Password='" & txtPass.Text & "';"
Related Posts Related QUESTIONS :
  • Mergefield for objectname of PDF using Access and VBA
  • VBA code for giving slides a constant name
  • why msg box is not working when i try to run a loop with VBA
  • MS Access Temp tables
  • How to prevent UiPath from getting stuck in Call Macro Stage?
  • How do I speed up a double for loop with if in the inner loop in vba?
  • How to get inner text under span id
  • Passing argument(s) to a module private function/sub
  • VBA How to get all enum
  • How to split a string in VBA by more than one character
  • Manipulating excel "autoshapes" with VBA
  • How do I pass a Range to a Sub in Word VBA?
  • How to create an addin for PowerPoint 2003
  • BCC in ItemSend event in Outlook 2007 no longer works
  • ArcObjects - enumerating feature classes and datasets within a geodatabase
  • Hidden pitfalls of VBA
  • Auto accept outlook VBA
  • Searching a document for multiple terms in VBA?
  • How do I access the value of a textbox control on a subform where the subform itself is just a control on another subfor
  • How can i change every occurence of a specific font ind a Word document?
  • How to add YES/NO checkbox column to existing table using VBA?
  • Is it possible to use the filename generated by previous code as the variable for next line of code?
  • Changing the ColorIndex of a DataLabel is not behaving as stated by the documentation
  • Filter SubForm based on multiple criteria
  • How to get email address with VBA based on windows login name?
  • How can I make this code better / quicker?
  • Text from listbox into array, text not making it into my array unless I click an item in the listbox first
  • vba standard function from an input box and show results
  • For each "group": sum the respective volume and colli count
  • Add start and end word fields for tracked changes
  • Replace text in Word VBA based on Multiple Font Conditions
  • Is there a VBA event triggered when a Word document is closed?
  • How to decompile a access database without starting/opening it?
  • Run on the master workbook, check if there are any new or deleted worksheets in the daily input workbook
  • Is there any C-style string formatting in VBA?
  • VBA - Overflow error if passing certain digits to another sub
  • Making an appointment in a public folder calender
  • Document Export failing in ms-project vba
  • How to select record with max value and use variable to reference recordset field name?
  • Applying shading to character styles using Word VBA
  • Assign Word Table Cell values to variable in Word Document
  • Can't pull out a specific field available in every row in a table from a webpage
  • Use VBA to check for text before taking action without selecting text
  • Using a variable instead of the fieldname
  • DCount using Multiple Criteria
  • Changing the value of an ActiveX control field in Word through a VBA macro
  • Modify properties for individual controls in the details section of a form in continuous forms view
  • VBA How to fix: "Property or method is not supported with this object" when cell securing in multiple sheets
  • Opening .ppsm also opens powerpoint editor
  • Invalid use of null in a Date variable
  • How can I change this code so that it task scheduler can run it as a .vbs file?
  • Trouble selecting a hidden menu item using SeleniumBasic for vba
  • VBA Query - Compare a string with the value of 2 rows
  • Format function convert "23.6" in "1,0"
  • I want to move a cursor to below a specific table in word using vba
  • Adjusting row height if tables in word using vba
  • How can i put a check on one integer so that the if i run the code again it will not detect the value?
  • How To Code So That Intellisense Follows The Complete Chain
  • Difference between VBA.CBlah and CBlah
  • Paste the copied number in Find dialog box
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com