Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Can I have a user form with no Header/Caption Bar ?

Can I have a user form with no Header/Caption Bar ?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Can I have a user form with no Header/Caption Bar ?

go to Stephen Bullen's site and download formfun.zip and unzip it. The
workbook shows you code for doing all kinds of things with userforms
including what you ask.

http://www.bmsltd.ie/Excel/Default.htm
--
Regards,
Tom Ogilvy

"RandyDtg1" wrote in message
...
Can I have a user form with no Header/Caption Bar ?

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can I have a user form with no Header/Caption Bar ?

Juts be aware that without the Caption (removes the Menu controls) yo
will not be able to move the Userform. Post back if you need code t
move it

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Can I have a user form with no Header/Caption Bar ?

I'm trying, but I'm not sure which code I need or don't need. I suspect it is
just a few lines. Any help on which, if I just want a form with no
caption/header bar?

I plan to use mouse move to close box.
Or is there a better way to put a short user message up, with out using msgbox,
more like a splash screen.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Can I have a user form with no Header/Caption Bar ?

This should do it.

Option Explicit

Private Declare Function GetWindowRect Lib "User32" ( _
ByVal hWnd As Long, _
lpRect As RECT) As Long

Private Declare Function FindWindow Lib "User32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Declare Function SetWindowLong Lib "User32" _
Alias "SetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Declare Function GetWindowLong Lib "User32" _
Alias "GetWindowLongA" ( _
ByVal hWnd As Long, _
ByVal nIndex As Long) As Long


'// Used for moving Captionless form
Private Declare Function SetWindowPos Lib "User32" ( _
ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long

Private Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000 ' WS_BORDER O
WS_DLGFRAME
Private Const WS_SYSMENU = &H80000

Private Const SWP_FRAMECHANGED = &H20 ' The frame changed: sen
WM_NCCALCSIZE
Private Const SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering
Private Const SWP_NOREDRAW = &H8
Private Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOZORDER = &H4

Private Type POINTAPI
X As Long
Y As Long
End Type

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type



Private Sub UserForm_Activate()
Dim lStyle As Long
Dim tR As RECT
Dim FrmWndh As Long

'// Get Forms window handle set Variable NOW!
FrmWndh = FindWindow(vbNullString, Me.Caption)

'// Get the window's position:
GetWindowRect FrmWndh, tR

'// Modify whether title bar will be visible:
lStyle = GetWindowLong(FrmWndh, GWL_STYLE)
lStyle = lStyle And Not WS_SYSMENU
lStyle = lStyle And Not WS_CAPTION

SetWindowLong FrmWndh, GWL_STYLE, lStyle

'// Ensure the style takes and make the window the
'// same size, regardless that the title bar
'// is now a different size:
SetWindowPos FrmWndh, 0, tR.Left, tR.Top, tR.Right - tR.Left, tR.Botto
- tR.Top, _
SWP_NOREPOSITION Or SWP_NOZORDER Or SWP_FRAMECHANGED
Me.Repaint

End Su

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

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
Form Caption Logo, How? WTG Excel Discussion (Misc queries) 1 March 1st 05 12:49 PM
Form Caption Logo, How? WTG Excel Worksheet Functions 0 February 27th 05 01:40 PM
User form - Picture in the caption? Ola[_4_] Excel Programming 2 February 17th 04 02:50 AM
Excel VBA - User form caption problem xlnoobie Excel Programming 2 February 7th 04 06:21 PM


All times are GMT +1. The time now is 07:25 PM.

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"