Results 1 to 15 of 15

InputBox Function not as flexible as needed

Threaded View

  1. #1
    Registered User
    Join Date
    02-16-2013
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    24

    InputBox Function not as flexible as needed

    I'm using a simple inputbox function to query a number of variables from the workbook user, to be used in a new object created from a class module.

    I'd like to name the new object a unique concatenation of the variables being stored within it to archive in a library for tracking.

    Currently, my functions (seven in all) are written as such:
    Function candfirstname() As String
    
    Dim Prompt As String
    Dim Title As String
    'Declares Prompt and Title as string variables
    
    Prompt = "Please enter the candidate's first name"
    Title = "Candidate First Name"
    'Assigns string values to Prompt and Title for display in the InputBox
    
    candfirstname = InputBox(Prompt, Title)
    'Calls InputBox Application
    
    End Function
    I run into trouble because everytime I need to reference the returned variable in my primary macro I call a new InputBox (the function). I will also need to error check these user inputs in the function to ensure they're the appropriate datatype, thus it makes sense to return a different variable name from the function.

    How can I write my functions to call the inputbox function (function within a function) in such a way that a different variable name is returned? Please bear in mind the function should allow for IF statements to qualify the user input before being returned to the sub.

    I've included the workbook for reference. The primary macro is named "AddNMP", and the sub "InputBoxNewMarginPlacement" will ultimately be inserted / called into / by "AddNMP." The code is a bit messier than usual because I've been trying to test the concatenation, but those lines have been remarked - feel free to ignore.
    Last edited by dystopianprotagonist; 03-04-2013 at 10:59 PM.

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