Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 9 of 9

Thread: Message box to pop-up at file open

  1. #1
    Join Date
    27th April 2005
    Posts
    273

    Message box to pop-up at file open

    Hi All,

    How can I make a message box apear when a file is opened.

    I have a spread sheet and I need to create a small msg box with a logo (jpg) and some text so that every time it is opened the msg will pop up and dissapear after a second or two.

    Thanx

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,056

    Re: Message box to pop-up at file open

    Create a userForm, add your logo into an Image control and your message as a label caption.Then use the WorkBook_Open event
    VB:
    Private Sub Workbook_Open() 
         
        UserForm1.Show 
    End Sub 
    
    
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  3. #3
    Join Date
    25th January 2003
    Location
    Scotland
    Posts
    1,462

    Re: Message box to pop-up at file open

    Hi Alex,

    You could also add:
    VB:
    Private Sub UserForm_Activate() 
        Application.OnTime Now + TimeValue("00:00:03"), "KillTheForm" 
    End Sub 
    
    
    to the Activate event of the form that you want to pop up. This will show the form for 3 seconds.

    Regards,

    Bill

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    27th April 2005
    Posts
    273

    Re: Message box to pop-up at file open

    Thanx for the code!

    But, could you give me a step by step.

    I have never used VB!

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,684

    Re: Message box to pop-up at file open

    with a logo (jpg)
    This will be very difficult with a msgbox i suggest looking at a userform to be a place holder for the jpg and show for few seconds to read any text and then carry on with any codes or hide the userform

    jiuk
    Last edited by Jack in the UK; May 5th, 2005 at 17:50. Reason: Typo - jiuk

    Excel Video Tutorials / Excel Dashboards Reports


  6. #6
    Join Date
    26th January 2003
    Location
    Derbyshire,UK
    Posts
    18,056

    Re: Message box to pop-up at file open

    Bit complicated to start from scratch. Do a search for Splash Screen.
    Here is an example. No timer because you might find this too complicated
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.
    Hope that Helps

    Roy

    For free Excel tools & articles visit my web site

    If I have helped you and you feel like putting your hand in your pocket please make a donation to Children in Need

    RoyUK's Web Site

    royUK's Database Form

    Where to paste code from the Forum

    About me.

  7. #7
    Join Date
    15th April 2005
    Location
    India (Mumbai City)
    Posts
    10

    Re: Message box to pop-up at file open

    Hi Alex,

    For entering a VBA code follow this:

    Open Excel
    Tools>Macro>Visual Basic Editor
    A new window will open
    Then follow:
    Inser>Form
    insert a new UserForm into the project. This form is named UserForm1. Type your message in this form


    Now as I understand, you are looking for a splash screen which will be shown when an excel file opens and then automatically disapears it after some time.


    Now click on the "ThisWorkbook" in Project -VBAProject window at left side and paste the following code into the right pane
    VB:
    Private Sub Workbook_Open() 
        UserForm1.Show 
    End Sub 
    
    
    Now double click on the UserForm1 in left side pane and paste the following code:
    VB:
    Private Sub UserForm_Activate() 
        Application.OnTime Now + TimeValue("00:00:05"), "KillTheForm" 
    End Sub 
    
    
    Now click Insert>Module and
    Insert the following subroutine into right side pane.
    VB:
    Private Sub KillTheForm() 
        Unload UserForm1 
    End Sub 
    
    
    That's it!

    Niko
    Last edited by royUK; May 5th, 2005 at 18:03. Reason: add code tags, please use when posting codes

    Excel Video Tutorials / Excel Dashboards Reports


  8. #8
    Join Date
    25th January 2003
    Location
    Scotland
    Posts
    1,462

    Re: Message box to pop-up at file open

    Hi Alex,

    I have attached a small example. If you use this as a Template and copy your data from your file into this, then it is much easier than trying to talk you through VBA.

    If you press Ctrl+F11 together you will see the VBA screen. On the left hand side of the screen you will see UserForm1. Double click this and then click in the label that says "Company Name". Make sure on the left of the screen that the Properties are showing (It should show Properties-UserForm1). If not, click the Properties Window Icon (The hand holding the paper on the toolbar), double-click the Caption property and you can change the message in the label to whatever you want. You can re-size the label by dragging the handles around it. When you have finished, click Alt+F11 to return to Excel.

    Regards,

    Bill

    Regards,

    Bill
    Attached Files. REMINDER! OzGrid accepts no responsibility for ANY adverse effects as a result from downloading attached files. ALWAYS run an up-to-date virus scan and disable macros.

    Excel Video Tutorials / Excel Dashboards Reports


  9. #9
    Join Date
    27th April 2005
    Posts
    273

    Re: Message box to pop-up at file open

    Thanx!

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Show Message Box If File Already Open
    By black knight in forum EXCEL HELP
    Replies: 3
    Last Post: November 24th, 2007, 23:11
  2. Acknowledge Message On Open, Or Close File
    By willbaker13 in forum EXCEL HELP
    Replies: 18
    Last Post: August 1st, 2007, 11:18
  3. [Solved] VBA: File open: error message
    By Xerde in forum EXCEL HELP
    Replies: 3
    Last Post: August 18th, 2003, 23:01

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
  •  
porno