Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Re-POST: How to close forms opened from other workbooks...?

Take It, It Can't be done..?
Thanx anyway.
| From: "Andrew" <NoToSPAM@home
| Subject: How to close forms opened from other workbooks...?
| Date: Sun 12 June 2005 20:22
|
| I have a form that is loaded(show) from Personal.xls.
| Other workbooks can then be opened.
|
| Q. how is it possible to check if the form (Main.FRM) is open and close it
| or reference a listbox item if it is open.
|
| Is there a way of:
| If Userforms("Main") then
| ThisTextbox.text=Workbooks("Personal").Main.TextBo x1.Text
| end if
|
| Thanks for any Help.
| Andrew


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Re-POST: How to close forms opened from other workbooks...?

You may be able to adapt the ideas documented by
http://support.microsoft.com/default...;en-us;Q157609

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , NoToSPAM@home
says...
Take It, It Can't be done..?
Thanx anyway.
| From: "Andrew" <NoToSPAM@home
| Subject: How to close forms opened from other workbooks...?
| Date: Sun 12 June 2005 20:22
|
| I have a form that is loaded(show) from Personal.xls.
| Other workbooks can then be opened.
|
| Q. how is it possible to check if the form (Main.FRM) is open and close it
| or reference a listbox item if it is open.
|
| Is there a way of:
| If Userforms("Main") then
| ThisTextbox.text=Workbooks("Personal").Main.TextBo x1.Text
| end if
|
| Thanks for any Help.
| Andrew



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Re-POST: How to close forms opened from other workbooks...?

Hi Andrew,

Not sure quite what you want to do but maybe something like this, with code
in two workbooks:

'' Book1, in a normal module
'' also in Book1, form "Userform1" and textbox "TextBox1"

Sub LoadForm()
UserForm1.Show vbModeless
UserForm1.Caption = ThisWorkbook.Name
End Sub

Function putText(s As String) As Boolean
Dim bRunning As Boolean
Dim uf As UserForm

If UserForms.Count Then
For Each uf In UserForms
If uf Is UserForm1 Then
bRunning = True
Exit For
End If
Next
End If

If s = "Quit" Then
If bRunning Then Unload UserForm1
Else
If bRunning = False Then LoadForm
UserForm1.TextBox1.Text = s
s = UserForm1.Caption
End If
putText = bRunning
End Function


'' in Book2, in a normal module
'' try Test1 & Test2 linked to buttons on a sheet in Book2

Sub RunForm(s As String)
Dim bWasRunning As Boolean
Dim sWBmame As String
sWBname = "Book1" ' change to suit
bWasRunning = Application.Run(sWBname & "!putText", s)
[a1] = "Form was already running : " & bWasRunning

End Sub

Sub Test1()
RunForm "Hi from " & ThisWorkbook.Name
End Sub
Sub Test2()
RunForm "Quit"
End Sub

Regards,
Peter T


"Andrew" <NoToSPAM@home wrote in message
...
Take It, It Can't be done..?
Thanx anyway.
| From: "Andrew" <NoToSPAM@home
| Subject: How to close forms opened from other workbooks...?
| Date: Sun 12 June 2005 20:22
|
| I have a form that is loaded(show) from Personal.xls.
| Other workbooks can then be opened.
|
| Q. how is it possible to check if the form (Main.FRM) is open and close

it
| or reference a listbox item if it is open.
|
| Is there a way of:
| If Userforms("Main") then
| ThisTextbox.text=Workbooks("Personal").Main.TextBo x1.Text
| end if
|
| Thanks for any Help.
| Andrew




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to save & close all opened files James A Excel Discussion (Misc queries) 1 December 23rd 06 05:16 AM
why do all excel worksheets/workbooks close when I close one? Penny Excel Discussion (Misc queries) 1 November 29th 06 03:49 AM
Re-POST: How to close forms opened from other workbooks...? Andrew Excel Programming 0 June 13th 05 01:54 PM
How to close forms opened from other workbooks...? Andrew Excel Programming 0 June 12th 05 08:22 PM
2nd post regarding Data Forms Melanie[_5_] Excel Programming 0 August 6th 03 11:21 PM


All times are GMT +1. The time now is 04:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"