User-defined type not defined

Solved
Thierry -  
 thierry -
Hello everyone,

Is there anyone who has the solution? I'm stuck.

Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As StringPtr, ByVal lpWindowName As StringPtr) As Long Private Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As LongPtr) As Long Private Declare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As LongPtr, ByVal nIndex As LongPtr, ByVal dwNewLong As LongPtr) As Long Private Declare PtrSafe Function DrawMenuBar Lib "user32" (ByVal hWnd As LongPtr) As Long Private Sub UserForm_Initialize() On Error Resume Next Dim hWnd As Long, Style As Long hWnd = FindWindow(vbNullString, Me.Caption) Style = GetWindowLong(hWnd, -16) And Not &HC00000 SetWindowLong hWnd, -16, Style DrawMenuBar hWnd End Sub 

The error is located in the first paragraph, thank you.

Configuration: Windows / Chrome 96.0.4664.93

EDIT: Added the code tags (syntax highlighting).
Explanations available here: HERE

Please keep this in mind in your future messages.

2 réponses

yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   Ambassadeur 1 588
 
Hello,
the first thing is to determine what type it is.
replace the types with long to detect which one is causing the issue.
0
Thierry
 
Hello,

The types are already in long format, I don't see what type it is?
I'm a novice when it comes to overly complex macros.
0
yg_be Posted messages 23437 Registration date   Status Contributeur Last intervention   1 588 > Thierry
 
A guy is a word that follows "as". I only see "long".

You are a beginner and you wrote this relatively complex macro?
0
thierry
 
Yes, but I learn very quickly :-), so in the meantime I managed to solve the problem, I identified the non-essential lines, I removed the components and no more issues,
thank you very much for your help and have a good evening.
0