Can't type in textBox using Keyboard

karedox

New Member
Joined
Jun 13, 2014
Messages
5
I have User form with one text Box in side, I change the window style of this User Form using " and Not WS_POPUP or WS_CHILD ".
I want this User Form to be Child Window Style.
After this process I can't type anything in textbox using keyboard.

Please help!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Child to which Parent ? Can you show the code ?

Thanks for your respond
this is my code in userform :
Code:
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long

Private Const WS_CHILD = &H40000000
Private Const WS_POPUP = &H80000000
Private Const GWL_STYLE = (-16)

Private Sub UserForm_Initialize()
Dim X As Long, Y As Long, z As Long
X = FindWindowA(vbNullString, Me.Caption)
Y = GetWindowLongA(X, GWL_STYLE)
Y = Y And Not WS_POPUP Or WS_CHILD
Y = SetWindowLongA(X, GWL_STYLE, Y)
z = SetParent(X, Application.hwnd)
End Sub
Any Suggestion ?
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top