Results 1 to 8 of 8

general purpose command button

Threaded View

Son_of_Thor general purpose command button 03-04-2014, 02:05 PM
Son_of_Thor Re: general purpose command... 03-04-2014, 02:08 PM
HaHoBe Re: general purpose command... 03-04-2014, 02:10 PM
Son_of_Thor Re: general purpose command... 03-04-2014, 02:15 PM
HaHoBe Re: general purpose command... 03-04-2014, 02:23 PM
Son_of_Thor Re: general purpose command... 03-04-2014, 03:05 PM
HaHoBe Re: general purpose command... 03-04-2014, 03:56 PM
Son_of_Thor Re: general purpose command... 03-04-2014, 04:18 PM
  1. #1
    Registered User
    Join Date
    02-20-2014
    Location
    nebraska
    MS-Off Ver
    Excel 2003
    Posts
    6

    general purpose command button

    I have Created a Userform with two buttons and a couple of text boxes and I would like this form to act similar to a vbyesno msgbox. The problem I am having is that I can't figure out how to make these buttons function without having to put a bunch of if-then statements in a Commandbutton1_click sub. What I would like to do is write a macro in a Module and then call the userform with text and write an if-then statement with the code for the buttons. For Instance:

    Sub Filesaveas()
    '
    ' Save Invoice As PDF for Billing Records
    '
    
    ' Save File
        Dim IntialName As String
        Dim fileSaveName As Variant
        InitialName = Range("F7").Text & "_" & Range("K2") & "_" & Range("F6")
        fileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitialName, _
        FileFilter:="PDF (*.pdf), *pdf")
            If fileSaveName <> False Then
                UserForm1.Caption = "Save As"
                UserForm1.TextBox1.Caption = "Save As:"
                UserForm1.TextBox2.Caption = "'" & fileSaveName & "'"
                UserForm1.TextBox1.Font.Bold = True
                UserForm1.TextBox2.Font.Bold = False
                UserForm1.TextBox1.Font.Italic = False
                UserForm1.TextBox2.Font.Italic = True
                UserForm1.TextBox2.TextAlign = fmTextAlignCenter
                UserForm1.TextBox1.TextAlign = fmTextAlignLeft
                UserForm1.Show
                If 'CommandButton1_Click Here' Then
                   'Action'
                Else
                    If 'CommandButton2_Click Here' Then
                        'Action'
                    End If
                End If
            End If
    End Sub
    Last edited by Son_of_Thor; 03-04-2014 at 02:14 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. General ODBC error on SQL command
    By penfold1992 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-25-2013, 06:08 AM
  2. Create a command button with code with a command button
    By jakara in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 01:28 PM
  3. [SOLVED] vba code, command bar, command bar button, one button works but not two
    By amazingg64 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2012, 09:55 AM
  4. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  5. [SOLVED] command button:Can i use a command button to open diffrrent sheets
    By Hellboy in forum Excel General
    Replies: 0
    Last Post: 11-03-2005, 11:00 AM

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