Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default keeping a userform visible


Hi!
Using <UserForm1.Show vbModeless on my ms calendar 11.0 keeps it
visible while selecting a new cell. Why doesn't it work for this?

<VBA.UserForms.Add(TempForm.Name).Show vbModeless

I am using code that auto-builds a userform (and then deletes it) based
on a list of headings (in the spreadsheet) for the option buttons. I'd
show the code but its awfully long.

Any help would be appreciated and thanks for your time!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=562904

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default keeping a userform visible

If you are using John Walkenbach's code or based your code on hise, I used
this approach to get it to work:

Dim sTempFormName as String

' set the ShowModal propery to False
TempForm.Properties("ShowModal") = False
' Show the form
' VBA.UserForms.Add(TempForm.Name).Show
sTempFormName = TempForm.Name
Names.Add Name:="FormName", RefersTo:="=""" & sTempFormName & """"
Application.OnTime Now, "ShowForm"

' removed the code to delete the tempform.

then created a routine named ShowForm to actually show the form


Sub ShowForm()
Dim sTempFormName as String
sTempFormName = Evaluate(ThisWorkbook.Names( _
"FormName").RefersTo)
VBA.UserForms.Add(sTempFormName).Show
End Sub


That worked for me.

Here is a link to Walkenbach's code:
http://www.j-walk.com/ss/excel/tips/tip76.htm

Using a Public variable didn't seem to work - that is why I created a
defined name.

--
Regards,
Tom Ogilvy

"Brian Matlack" wrote:


Hi!
Using <UserForm1.Show vbModeless on my ms calendar 11.0 keeps it
visible while selecting a new cell. Why doesn't it work for this?

<VBA.UserForms.Add(TempForm.Name).Show vbModeless

I am using code that auto-builds a userform (and then deletes it) based
on a list of headings (in the spreadsheet) for the option buttons. I'd
show the code but its awfully long.

Any help would be appreciated and thanks for your time!!


--
Brian Matlack
------------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
View this thread: http://www.excelforum.com/showthread...hreadid=562904


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default keeping a userform visible


Hi Tom! Thanks for your response!!
Yes I am using John W.s code I should have said so in the beginning
Sorry!

After I added your code I tryed to launch the code and got a run-tim
error '424': "Object required" when I debugged th
<TempForm.Properties("ShowModal") = False code was yellow hi-lited.

I put your Dim code at the top with the rest of them
I put <TempForm.Properties("ShowModal") = False directly under that
I put the
sTempFormName = TempForm.Name
Names.Add Name:="FormName", RefersTo:="=""" & sTempFormName & """"
Application.OnTime Now, "ShowForm"
directly under the <VBA.UserForms.Add(TempForm.Name).Show however th
first two lines are already there (at the top of the code after Dims)

I removed the code that deleted the tempform but I am unsure what to d
with the showform subroutine code you gave me since I use the followin
code to launch the whole thing

Dim Ops() As Variant
Dim Cnt As Integer, i As Integer
Dim UserChoice As Variant
If Not Intersect(ActiveCell, Range("vendors")) Is Nothing Then
Cnt = Range("VENDORLIST").Count
ReDim Ops(1 To Cnt)
For i = 1 To Cnt
Ops(i) = Range("VENDORLIST").Range("A1").Offset(i - 1, 0)
Next i
UserChoice = GetOption(Ops, 1, "Vendors")
If UserChoice = False Then
ActiveCell.Value = ""
Else
ActiveCell.Value = Ops(UserChoice)
End If
End If
End Sub

I'll keep working at it!
Any further help would be greatly appreciated and thanks again!

--
Brian Matlac
-----------------------------------------------------------------------
Brian Matlack's Profile: http://www.excelforum.com/member.php...nfo&userid=350
View this thread: http://www.excelforum.com/showthread.php?threadid=56290

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
Keeping certain columns/rows visible MichaelPhilips Excel Discussion (Misc queries) 2 January 8th 09 05:40 PM
Keeping first line visible Ann in Italy Excel Discussion (Misc queries) 4 June 15th 06 11:16 AM
Keeping images visible on sheets Mark Waiti Excel Programming 0 April 10th 06 05:04 AM
Keeping images visible on sheets Mark Waiti Excel Programming 1 April 9th 06 01:39 PM
Keeping excel visible Mike K Excel Programming 3 September 9th 05 04:39 PM


All times are GMT +1. The time now is 03:37 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"