Private Sub Go_Click()
'to initiate the second form
Dim NewFile As String
NewFile = "2.XLS"
If Not WorkbookOpen(NewFile) Then
Workbooks.Open NewFile
End If
Application.Run "2.xls!StartForm"
Me.Hide
ThisWorkbook.Close False
End Sub
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"Joe" <(E-Mail Removed)> wrote in message
news:22a9403b-f456-4b41-ade5-(E-Mail Removed)...
> Hi all,
>
> I have two files 1.xls and 2.xls.
>
> 1.xls is open
> 2..xls is not open.
>
> from 1.xls I have to display a form which is in 2.xls
>
> My code is...
>
> '******************************************
> ' Code in 1.xls
>
> Function WorkbookOpen(ByVal WorkBookName As String) As Boolean
> ' returns TRUE if the workbook is open
>
> WorkbookOpen = False
> On Error GoTo WorkBookNotOpen
> If Len(Application.Workbooks(WorkBookName).Name) > 0 Then
> WorkbookOpen = True
> Exit Function
> End If
>
> WorkBookNotOpen:
> End Function
>
> '***************************************************
>
> Private Sub Go_Click()
> 'to initiate the second form
>
> Dim NewFile As String
>
> NewFile = "2.XLS"
>
> If Not WorkbookOpen(NewFile) Then
> Workbooks.Open NewFile
> End If
>
> ' I WANT TO ADD CODE FOR CALLING THE FUNCTION STARTFORM()
> ' WHICH IN TURN WILL MAKE THE FORM TO BE SHOWN.
> ' STARTFORM() is in Model1 of 2.xls
>
> Me.Hide
> ThisWorkbook.Close False
>
> End Sub
>
>
> '******************************************
>
>
> I tried to google, but I get confused. Could not find any specific
> result...
> I would like to know how I can call the function "STARTFORM()" which
> is in the Module1 of 2.XLS.
>
> Thanks a lot.....
>
> Regards
> Joe
|