+ Reply to Thread
Results 1 to 1 of 1

Run userform in a worksheet from personal.xlsb

Hybrid View

  1. #1
    Registered User
    Join Date
    09-28-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    9

    Run userform in a worksheet from personal.xlsb

    Hi all,
    i have a little spreadsheet which i use to organise bits and bobs,

    the plan was to have a button on the ribbon at the top, so if i pressed it would open the spreadsheet if necessary then it would run a userform from that spreadsheet thus i used the following code:
    Option Explicit
    
    Public Const fpath = "s:\5.Investment Office\11. Operations\"
    Public Const fname = "sjc project task list.xlsm"
    Public Const fuf1 = "sjc project task list.xlsm!calluf1"
     
    Sub openMyFile()
         
        On Error Resume Next
        Workbooks(fname).Activate
         
         'If Excel cannot activate the book, then it's not open, which will
         '  in turn create an error not of the value 0 (no error)
         
        If Err = 0 Then
           
          
           Application.Run ("sjc project task list.xlsm!module1.calluf1")
           Else
         
        Err.Clear 'Clear erroneous errors
        Workbooks.Open fpath & fname
         
        Application.Run fuf1
         End If
         
    End Sub
    where CallUF1 is a sub routine which basically says userform1.show - this works, i just cant get the application to run and actually show the userform.

    as ever in your hands
    Last edited by Leith Ross; 12-18-2012 at 06:23 PM. Reason: Added Code Tags

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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