|
-
Jul 23rd, 2003, 02:38 PM
#1
Thread Starter
Frenzied Member
VBA form border *SEMI-SOLVED*
I posted a question in the Maths Forum and managed to solve the basic problem.
http://www.vbforums.com/showthread.p...65#post1486865
However, my solution was to make a macro to function like an Excel Wizard.
The thing that I can't get right, is removing the borders on the form to
make it look like the usual function Wizards.
I have a feeling it is one of the things that is cut out of VB for VBA 
Have I missed something or can it be done another way?
API?
Last edited by agmorgan; Jul 24th, 2003 at 06:41 AM.
-
Jul 23rd, 2003, 06:40 PM
#2
Fanatic Member
I ran your wizard form and then I checked the "Lookup Wizard" form. They look the same, I guess I am not sure what type of effect you are looking for (I ran it on Win2K, Excel 97)
Can you post an image of the type of wizard border you are looking for?
"Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!
Resistance is futile, you will be compiled . . . Please!
-
Jul 24th, 2003, 05:05 AM
#3
Thread Starter
Frenzied Member
hmmm, maybe Wizard is the wrong word
This is what I am trying to achieve
-
Jul 24th, 2003, 06:38 AM
#4
Thread Starter
Frenzied Member
Credit to Stephen Bullen for this as I learned how to do it from his formfun.zip demo
http://www.bmsltd.co.uk/Excel/Default.htm
Create a Class Module called cTitleBarHider and put the following code in it
VB Code:
Option Explicit
Private Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
'Windows API calls to do all the dirty work!
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 ShowWindow Lib "user32" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function SetFocus Lib "user32" (ByVal hWnd As Long) As Long
Private Const GWL_STYLE As Long = (-16) 'The offset of a window's style
Private Const WS_CAPTION As Long = &HC00000 'Style to add a titlebar
'Constants for hide or show a window
Private Const SW_SHOW As Long = 5
'Variables to store the various selections/options
Dim hWndForm As Long, mbSizeable As Boolean, mbCaption As Boolean, mbIcon As Boolean, miModal As Integer
Dim oForm As Object
Public Property Set Form(oForm As Object)
Dim iStyle As Long
Dim hWndForm As Long
' If Val(Application.Version) < 9 Then
' 'XL97
' hWndForm = FindWindow("ThunderXFrame", oForm.Caption)
' Else
' 'XL2000
' hWndForm = FindWindow("ThunderDFrame", oForm.Caption)
' End If
hWndForm = FindWindow("ThunderDFrame", oForm.Caption)
iStyle = GetWindowLong(hWndForm, GWL_STYLE)
iStyle = iStyle And Not WS_CAPTION
SetWindowLong hWndForm, GWL_STYLE, iStyle
DrawMenuBar hWndForm
End Property
Then put this is in the form that you dont want to have a title bar
VB Code:
Dim oTitleBarHider As New cTitleBarHider
Private Sub UserForm_Activate()
Set oTitleBarHider.Form = Me
End Sub
Im pretty sure that does it all!
Just need to work out how to fix the form in place in cell A1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|