+ Reply to Thread
Results 1 to 6 of 6

Userform not running when document is opening

Hybrid View

  1. #1
    Registered User
    Join Date
    01-28-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    44

    Userform not running when document is opening

    Hi all,

    i have the following code:

    
    Private Sub userform1_Open()
        Range("Ag4").Select
        OPENMESS.Show
    End Sub
    when I test it in the macro window it works but this does not work when the document opens. This ducoment comes from a sharepoint server and a user needs to enable the document before editing. Is this enabling the cause of the userform (OPENMESS) not running when document is open

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Userform not running when document is opening

    Code must be:
    Private Sub Workbook_Open()
        Range("Ag4").Select
        OPENMESS.Show
    End Sub
    and this must be located in ThisWorkbook module.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Registered User
    Join Date
    01-28-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Userform not running when document is opening

    Hi Izandol,

    Thank you. It is located in ThisWorkbook module. I have changed as per the bold above.

    now it opens but gives me a RUN TIME ERROR 424

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Userform not running when document is opening

    If the userform is named OPENMESS then I think you have error in the code for Userform_Initialize or Userform_Activate events. You may press f8 and step through code to locate the error after the debug message.

  5. #5
    Registered User
    Join Date
    01-28-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    44

    Re: Userform not running when document is opening

    Thank you very much Isandol. REP has been send.

  6. #6
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Userform not running when document is opening

    You are welcome - and thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Opening workbook from userform keeping userform at background..
    By cooldude113322 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-05-2012, 12:14 PM
  2. Opening a document to a new window
    By chalky in forum Excel General
    Replies: 5
    Last Post: 05-11-2007, 03:33 PM
  3. Opening Protected XL Document
    By jo_peti in forum Excel General
    Replies: 0
    Last Post: 07-26-2005, 03:05 AM
  4. Opening a csv document
    By excel dummie in forum Excel General
    Replies: 0
    Last Post: 03-17-2005, 06:46 PM
  5. Do this when opening new document
    By semtex in forum Excel General
    Replies: 23
    Last Post: 01-08-2005, 10:32 AM

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