Results 1 to 7 of 7

Inputbox button control + msgbox for empty inputbox

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Inputbox button control + msgbox for empty inputbox

    Hello.

    Somethink that seam so simple in my head is turning out to be a pain in the butt.

    I have the inputbox so i can set a string value,
    When the inputbox Cancle button is pressed i want to exit sub,
    If the inputbox value is nothink and ok button, I want the msgbox displayed then goto newname.
    If the inputbox has a value do >>>>>>That>>>>>

    Private Sub CommandButton6_Click()                            'Upload File
    Dim strName As String
    Dim imgfolder As String
    
        'get the path to the images
            imgfolder = ThisWorkbook.Path & Application.PathSeparator & _
        "Images" & Application.PathSeparator
        'load picture to form
    
                                                                    ' Chane file name
    If Label1.Caption = "" Or Label1.Caption = vbNewLine & "                                       " & _
    "Upload Files From Computer..." Then Exit Sub Else
    
    NewName:
    
        strName = InputBox(Prompt:=Label1.Caption & vbNewLine & vbNewLine _
        & vbNewLine & vbNewLine & "Rename File Before Database Entry???", _
              Title:="Attachment File Name", Default:="Your Name here"): Rem change for filename
        If vbCancel Then Exit Sub
        
        
        If strName = "" Then msgbox "A Name Must Be Entered", vbOKOnly
        If vbOKOnly And strName = "" Then GoTo NewName
        
        
        If strName <> "" Then FileCopy Label1.Caption, imgfolder & strName & ".jpg"
        ListBox1.AddItem strName
        Label1.Caption = vbNewLine & "                                       " & _
    "Upload Files From Computer..."
        CommandButton6.Font.Bold = False
    Thankyou.
    Last edited by D_Rennie; 06-30-2009 at 11:50 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1