Consulting

Results 1 to 3 of 3

Thread: Want to configure inputbox & msgbox in PowerPoint using vba

  1. #1
    VBAX Regular
    Joined
    Sep 2020
    Posts
    22
    Location

    Want to configure inputbox & msgbox in PowerPoint using vba

    Sir want a little help.

    I want to configure inputbox(only input = 3 will be valid) & msgbox in such a way that if i put number 3 as a input number then it browse my pc's C drive.
    Also i want to exit when i hit the X mark in every msgbox/inputbox.

    1. When i put nothing/blank in msgbox1(see attachment) & hit ok button then it takes me to msgbox2(see attachment). When i hit the X mark in msgbox2 it takes me to my C drive(in that case i want to exit whenever i hit X mark ).

    So I want to configure exactly as shown in attachment picture: wanted_diagram


    Dim inputNumber As Long

    Dim inputResponse As String

    inputResponse = InputBox("Please enter number : ", "Insert Data", "Input only number 3")

    If IsNumeric(inputResponse) Then
    inputNumber = inputResponse
    If inputNumber <> 3 Then
    MsgBox "Enter only number 3"
    Else: MsgBox "Confirm You want to insert data in " & inputNumber & " blocks"

    End If
    ElseIf inputResponse = "" Then
    MsgBox "You did not enter anything!"

    Exit Sub
    End If

    MsgBox "Please select/browse data excel file from your computer! "


    Dim fDialog As FileDialog
    Dim filepath As String

    Set fDialog = Application.FileDialog(msoFileDialogFilePicker)

    'Optional: FileDialog properties
    fDialog.AllowMultiSelect = False
    fDialog.Title = "Select a file"
    fDialog.InitialFileName = "C:"
    'Optional: Add filters
    fDialog.Filters.Clear
    fDialog.Filters.Add "Excel files", "*.xlsx"
    fDialog.Filters.Add "All files", "*.*"


    'Show the dialog. -1 means success!
    If fDialog.Show = -1 Then
    filepath = fDialog.SelectedItems(1)
    Else
    End If
    Attached Images Attached Images
    Last edited by Jhon90; 03-03-2021 at 09:02 AM.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,704
    Location
    I dunno :
    But play around with
    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Handles btnExit.Click
        Dim x
        x = sender.Name
      End Sub
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Master
    Joined
    Feb 2007
    Posts
    1,999
    Location
    This sort of thing maybe
    Sub inputter()
    Do
    Dim strIn As String
    strIn = InputBox("Enter 3")
    If strIn = "" Then MsgBox "Enter a Number"
    If strIn <> "3" And strIn <> "" Then MsgBox "Enter 3"
    Loop Until strIn = "3"
    ' rest of code
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Tags for this Thread

Posting Permissions

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