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
Bookmarks