LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userform disappears when you try to initialize from a command button

When I run the userform initialize procedure to reset the values in tex
boxes and the like instead of resetting like it should, now it close
the userform completely and then won't allow me to show it again, wha
could be the problem?




Code
-------------------
Private Sub UserForm_Initialize()
Me.MultiPage1.Value = 0
TextBox3.Value = ActiveWorkbook.Sheets("Sales Invoice").Range("G15").Value
Dim hWndForm As Long
Dim hMenu As Long
hWndForm = FindWindow("ThunderDFrame", Me.Caption) 'XL2000
hMenu = GetSystemMenu(hWndForm, 0)
DeleteMenu hMenu, SC_CLOSE, 0&
End Sub

-------------------





The Dim stuff down is to gray out the x button, there are also som
module level declarations to go with that...



Code
-------------------
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Const SC_CLOSE As Long = &HF060

-------------------





Can anyone help me out, I thought I had solved a real big problem onl
to get this, the userform shows when the workbook opens and is the
hidden when the user has finished entering values, then when the use
goes through the process of being asked to print and save, they ar
then asked if they would like to create a new record, if yes then i
shows the userform again, but the userform is still filled with all th
stuff previously entered. I tried using the unload me instead of hidin
and that wouldn't work at all, didn't give errors just didn't show th
userform either, this at least shows the userform, but now when th
user goes to clear the information by initializing the userform again
it simply closes the userform and then it can't be shown again either
Please help

--
Message posted from http://www.ExcelForum.com

 
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
Data Field button disappears? Rich Charts and Charting in Excel 1 September 13th 07 05:38 PM
Command Button Disappears?? TrevorC Excel Discussion (Misc queries) 4 July 19th 06 06:17 PM
Userform Initialize & combo box values michaelberrier Excel Discussion (Misc queries) 3 June 27th 06 04:35 PM
Second option button disappears when I make another column Monique Excel Worksheet Functions 0 March 9th 05 09:57 PM
SaveCopyAs - Userform disappears mohsinb[_2_] Excel Programming 1 November 6th 03 04:02 PM


All times are GMT +1. The time now is 09:49 PM.

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

About Us

"It's about Microsoft Excel"