none
Properly Opening an Excel Workbook from a PowerPoint Show RRS feed

  • Question

  • Hello everyone.

    My name is Julian and this is my first time on this forum!

    I'm 21 years old and I've been given some opportunities to learn VBA at my current internship. I've learned VBA by visiting a number of forums on the internet. Right now, I'm putting some finishing touches on a Visitor Sign-in Kiosk that I made by myself using Excel.

    I have it set up so that there's a powerpoint running on a computer out in the receptionist area of our facility.

    There are two command buttons for signing in and signing out. Here's the code I have for "signing in."

    Private Sub CommandButton5_Click()
    Dim x2App As Excel.Application
    Set x2App = New Excel.Application

    x2App.Visible = True

    x2App.Workbooks.Open "[Excel file here]", True, False

    On Error Resume Next

    x2App.Run "Login"

    Set x2App = Nothing

    End Sub

    So I have a powerpoint show running the whole time. Most of the time clicking on the command button will open the Excel file and the userforms just fine. There are times where I click on the button and the userform opens, but it's not brought out to the front.

    I can open Task Manager > Applications and then "Switch To" the userform, but I can't have the visitors doing that every so often.

    So what can I do?

    Thank you for your help! Any advice about posting, and especially about my novice coding will be much appreciated!

    Monday, September 14, 2015 7:55 PM

All replies

  • Also, here's my code for when the userform opens (ON EXCEL FILE):

    Private Sub UserForm_Activate()
     'ActiveWindow.Visible = False
     'Application.WindowState = xlMinimized
     Application.Visible = False
    End Sub


    When the visitor hits a "Sign in" command button to submit their entry (this is the last part of the code):

    Application.DisplayAlerts = False
    ThisWorkbook.Save
    Application.DisplayAlerts = True
    Application.Quit


    And when the userform is terminated:

    Private Sub UserForm_Terminate()
    Application.Visible = True
    End Sub



    Monday, September 14, 2015 8:03 PM