ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Private Declare Function (https://www.excelbanter.com/excel-programming/394483-private-declare-function.html)

David A.

Private Declare Function
 
How do I get
Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

to function with:

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub



John Bundy

Private Declare Function
 
Insert a general module and place the functions in there
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

How do I get
Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

to function with:

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub



David A.

Private Declare Function
 
I'm going to need step by step dirrections. I have tried everything. I am
just not doing it right...
I am sorry.

Thanx.



"John Bundy" wrote:

Insert a general module and place the functions in there
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

How do I get
Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

to function with:

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub



John Bundy

Private Declare Function
 
I assume you have VB editor opened, rightclick the project screen, if you
don't see this press ctl+R, and select insert-userform. doubleclick the for
to get to the code, erase everything there then paste the sub codes there

Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub




repeat the process but insterting a userform, insert a module
paste the rest of the code there

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

make sure you have a sheet named MAIN as that is what is referenced above,
that or change it. Let me know how it goes.

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

I'm going to need step by step dirrections. I have tried everything. I am
just not doing it right...
I am sorry.

Thanx.



"John Bundy" wrote:

Insert a general module and place the functions in there
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

How do I get
Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

to function with:

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub



John Bundy

Private Declare Function
 
looks like there were parts of code that did not come through, here is the
code to put into the module

Public Declare Function SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long

Public Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

I'm going to need step by step dirrections. I have tried everything. I am
just not doing it right...
I am sorry.

Thanx.



"John Bundy" wrote:

Insert a general module and place the functions in there
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

How do I get
Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

to function with:

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub



David A.

Private Declare Function
 
Finally, it works.

OMG thank you, I've been working on this soooooooo long, Thank you thank you
thank you.

"John Bundy" wrote:

looks like there were parts of code that did not come through, here is the
code to put into the module

Public Declare Function SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long

Public Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

I'm going to need step by step dirrections. I have tried everything. I am
just not doing it right...
I am sorry.

Thanx.



"John Bundy" wrote:

Insert a general module and place the functions in there
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

How do I get
Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

to function with:

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub



John Bundy

Private Declare Function
 
No problem, it is always good to help someone that takes the initiative to
find ways to make things easier. Good luck and keep it up!
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

Finally, it works.

OMG thank you, I've been working on this soooooooo long, Thank you thank you
thank you.

"John Bundy" wrote:

looks like there were parts of code that did not come through, here is the
code to put into the module

Public Declare Function SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long

Public Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

I'm going to need step by step dirrections. I have tried everything. I am
just not doing it right...
I am sorry.

Thanx.



"John Bundy" wrote:

Insert a general module and place the functions in there
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"David A." wrote:

How do I get
Private Sub UserForm_Activate()
Application.Wait Now + TimeValue("00:00:03")
Unload Me
Application.ScreenUpdating = False
Sheets("main").Select
Application.ScreenUpdating = True
End Sub

to function with:

SetWindowLong _
Lib "user32" _
Alias "SetWindowLongA" ( _
ByVal hwnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) _
As Long
Private Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) _
As Long

Private Sub UserForm_Initialize()
SetWindowLong FindWindow(vbNullString, Me.Caption), _
-16, -2067791744
End Sub




All times are GMT +1. The time now is 09:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com