Bonjour,
J'ai trouvé ce code vba sur internet et j'aimerais savoir ce qu'il fait.
Apparemment il modifie le PrintArea des feuilles mais je comprends pas ce qu'il fabrique avec l'adresse de la fonction4.
Comme les noms des fonctions étaient "cryptés", je les ai remplacés par fonction1,fonction2, etc.
Code dans ThisWorkbook :
et dans un module :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 Private Sub Workbook_Open() variablelong = fonction3("XLMAIN", Application.Caption) fonction1 variablelong, &H480, ObjPtr(Application), 0 fonction1 variablelong, &H500, 2, AddressOf fonction4 End Sub Public Sub fonction2() Dim PrArea As String On Error Resume Next For Each sh In ThisWorkbook.Sheets PrArea = ThisWorkbook.Names(sh.Name & "!print_area") If PrArea <> "" Then ThisWorkbook.Names(sh.Name & "!print_area").Delete sh.PageSetup.PrintArea = PrArea End If Next End Sub
Merci pour votre aide !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 Public Declare Function fonction1 Lib "user32.dll" Alias "SendMessageA" (ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare Function fonction3 Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Public variablelong As Long Public Sub fonction4() On Error Resume Next ThisWorkbook.fonction2 End Sub
Partager