Consulting

Results 1 to 3 of 3

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Sep 2020
    Posts
    40
    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 Aussiebear; 03-27-2023 at 02:40 AM. Reason: Added code tags to supplied code

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
  •