B
Bishop
I have the following code:
'On open the AddOrFind userform is displayed
Sub Workbook_Open()
AddOrFind.Show
End Sub
*************************************
'the following code shows the userform with no title bar
Option Explicit
Const GWL_STYLE = -16
Const WS_CAPTION = &HC00000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) 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 DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As
String, _
ByVal lpWindowName As String) As Long
Private Sub Userform_Initialize()
Dim lngWindow As Long, lFrmHdl As Long
lFrmHdl = FindWindowA(vbNullString, Me.Caption)
lngWindow = GetWindowLong(lFrmHdl, GWL_STYLE)
lngWindow = lngWindow And (Not WS_CAPTION)
Call SetWindowLong(lFrmHdl, GWL_STYLE, lngWindow)
Call DrawMenuBar(lFrmHdl)
End Sub
'the AddOrFind userform gives two options: Add A Title and Find A Title.
'this code allows you to simply press the letter 'a' to show the AddTitle
'userform
Private Sub AddButton_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim A As Integer
If Chr(KeyCode) = "A" Then
AddTitle.Show
End If
End Sub
**************************************
'the following code shows the AddTitle userform without a title bar
Option Explicit
Const GWL_STYLE = -16
Const WS_CAPTION = &HC00000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) 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 DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As
String, _
ByVal lpWindowName As String) As Long
Private Sub Userform_Initialize()
Dim lngWindow As Long, lFrmHdl As Long
lFrmHdl = FindWindowA(vbNullString, Me.Caption)
lngWindow = GetWindowLong(lFrmHdl, GWL_STYLE)
lngWindow = lngWindow And (Not WS_CAPTION)
Call SetWindowLong(lFrmHdl, GWL_STYLE, lngWindow)
Call DrawMenuBar(lFrmHdl)
End Sub
OK, the problem I'm having is that when I open this workbook the AddOrFind
userform is supposed to display but instead the workbook open and the title
bar (for the workbook) is flashing. I have to click the screen with my mouse
in order to make the userform show. Once the AddOrFind userform is up I can
hit 'a' and the AddTitle userform shows (as it should) BUT "something" is
still running. I can't Alt-F11 into VBE. If I have VBE open already I can
click it open and it says "running" in the title bar. I have to click reset
to stop whatever is still running before I can proceed. What I WANT to
happen is when I press 'a' and the AddTitle userform shows I want to be able
to add information to that userform but I can't until I hit reset. What is
causing this?
'On open the AddOrFind userform is displayed
Sub Workbook_Open()
AddOrFind.Show
End Sub
*************************************
'the following code shows the userform with no title bar
Option Explicit
Const GWL_STYLE = -16
Const WS_CAPTION = &HC00000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) 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 DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As
String, _
ByVal lpWindowName As String) As Long
Private Sub Userform_Initialize()
Dim lngWindow As Long, lFrmHdl As Long
lFrmHdl = FindWindowA(vbNullString, Me.Caption)
lngWindow = GetWindowLong(lFrmHdl, GWL_STYLE)
lngWindow = lngWindow And (Not WS_CAPTION)
Call SetWindowLong(lFrmHdl, GWL_STYLE, lngWindow)
Call DrawMenuBar(lFrmHdl)
End Sub
'the AddOrFind userform gives two options: Add A Title and Find A Title.
'this code allows you to simply press the letter 'a' to show the AddTitle
'userform
Private Sub AddButton_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Dim A As Integer
If Chr(KeyCode) = "A" Then
AddTitle.Show
End If
End Sub
**************************************
'the following code shows the AddTitle userform without a title bar
Option Explicit
Const GWL_STYLE = -16
Const WS_CAPTION = &HC00000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) 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 DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As
String, _
ByVal lpWindowName As String) As Long
Private Sub Userform_Initialize()
Dim lngWindow As Long, lFrmHdl As Long
lFrmHdl = FindWindowA(vbNullString, Me.Caption)
lngWindow = GetWindowLong(lFrmHdl, GWL_STYLE)
lngWindow = lngWindow And (Not WS_CAPTION)
Call SetWindowLong(lFrmHdl, GWL_STYLE, lngWindow)
Call DrawMenuBar(lFrmHdl)
End Sub
OK, the problem I'm having is that when I open this workbook the AddOrFind
userform is supposed to display but instead the workbook open and the title
bar (for the workbook) is flashing. I have to click the screen with my mouse
in order to make the userform show. Once the AddOrFind userform is up I can
hit 'a' and the AddTitle userform shows (as it should) BUT "something" is
still running. I can't Alt-F11 into VBE. If I have VBE open already I can
click it open and it says "running" in the title bar. I have to click reset
to stop whatever is still running before I can proceed. What I WANT to
happen is when I press 'a' and the AddTitle userform shows I want to be able
to add information to that userform but I can't until I hit reset. What is
causing this?