Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 5d4d97eb90841709…

MALICIOUS

Office (OLE)

777.5 KB Created: 2010-05-25 21:45:37 Authoring application: Microsoft Excel First seen: 2018-06-21
MD5: 4526f1f2be8d41aed0544319f8cfa028 SHA-1: 453f8bc61577bba7b32b009d506643cb0f9d565d SHA-256: 5d4d97eb90841709d8588537b807755156cd6444b59daf0d39a6b928bba20918
102 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1566.001 Spearphishing Attachment

The sample is an Excel file containing VBA macros, which are often used to deliver malicious payloads. The document body contains Japanese text that appears to be a form for employment or insurance-related benefits, suggesting a social engineering lure. Heuristics indicate the use of CreateProcess and ShellExecute APIs, common in malware for executing further stages. No specific malware family could be identified.

Heuristics 4

  • Reference to CreateProcess API high SC_STR_CREATEPROCESS
    Reference to CreateProcess API
  • Reference to ShellExecute API high SC_STR_SHELLEXEC
    Reference to ShellExecute API
  • VBA macros detected medium OLE_VBA_MACROS
    Document contains VBA macro code
  • 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 In document text (OLE body)

Extracted artifacts 1

Files carved from inside the sample during analysis.

FilenameKindSourceSize
macros.bas vba-macro oletools.olevba.extract_macros (decoded VBA source) 131813 bytes
SHA-256: 411f757a0ac5f9a5441689d2d548125850e479da866777373bee5eb3bdda97e3
Preview script
First 1,000 lines of the extracted script
Attribute VB_Name = "ThisWorkbook"
Attribute VB_Base = "0{00020819-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.Calculation = xlAutomatic

    ThisWorkbook.Saved = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    MsgBox "このファイルは保存できません。", 16, "保存"
    Cancel = True
End Sub


Attribute VB_Name = "Sheet4"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True













Attribute VB_Name = "Sheet11"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True
Option Explicit


Attribute VB_Name = "Sheet8"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True














Attribute VB_Name = "Sheet10"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True














Attribute VB_Name = "Sheet2"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True













Attribute VB_Name = "Sheet9"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True














Attribute VB_Name = "Sheet12"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True














Attribute VB_Name = "Sheet7"
Attribute VB_Base = "0{00020820-0000-0000-C000-000000000046}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = True





































Attribute VB_Name = "データフォーム"
Attribute VB_Base = "0{AFD15CA0-9AB9-4E20-BCC3-C47BE6413C8E}{049692B5-AAF4-4BFE-ACC0-577A089C43BC}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Explicit
Dim MyFile  As String
Dim i As Integer
Dim n As Integer
Private Sub Button閉じる_Click()

  Cells(4, 2).Value = Worksheets("DATA").Cells(38, 2).Value
  
  If TextBox1.Value = "" Then
  MsgBox "60歳到達賃金が入力されていません。"
  Else
   If OptionButton1.Value = True Then
     Range("U14:U19").Value = Range("W14:W19").Value '新率
   Else
     Range("U14:U19").Value = Range("V14:V19").Value '旧率
    End If

  Cells(6, 2).Value = ListBox1.Text
Cells(17, 3).Value = TextBox1.Value
Cells(19, 3).Value = Int(TextBox1.Value * Cells(15, 21).Value)
Cells(10, 21).Value = TextBox8.Value
Cells(11, 21).Value = TextBox9.Value
Cells(7, 29).Value = ListBox1.ListIndex
Unload Me
End If
End Sub


Private Sub ListBox1_Click()
Label37.Caption = ListBox1.Text
End Sub

Private Sub UserForm_Activate()
MyFile = Worksheets("DATA").Cells(1, 1).Value
With Workbooks(MyFile).Worksheets("個人情報")
n = 0
For i = 6 To .Cells(10000, 2).End(xlUp).Row
'取得日があって離職日がないデータ
If IsDate(.Cells(i, 29).Value) = True And IsDate(.Cells(i, 30).Value) = False Then

ListBox1.AddItem i '行番号
ListBox1.List(n, 1) = .Cells(i, 5).Value & " " & .Cells(i, 6).Value
n = n + 1
End If
Next
End With
   TextBox1.Value = Cells(17, 3).Value
   
   TextBox8.Value = Cells(10, 21).Value
   TextBox9.Value = Cells(11, 21).Value
On Error Resume Next
ListBox1.ListIndex = Cells(7, 29).Value


End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If KeyAscii = 8 Or KeyAscii = 45 Then Exit Sub
    If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End Sub
Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If KeyAscii = 8 Or KeyAscii = 45 Then Exit Sub
    If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End Sub
Private Sub TextBox7_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If KeyAscii = 8 Or KeyAscii = 45 Then Exit Sub
    If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End Sub
Private Sub TextBox8_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If KeyAscii = 8 Or KeyAscii = 45 Then Exit Sub
    If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End Sub
Private Sub TextBox9_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If KeyAscii = 8 Or KeyAscii = 45 Then Exit Sub
    If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End Sub


Attribute VB_Name = "フォーム60歳登録"
Attribute VB_Base = "0{C5E5061B-026A-4F58-BCE2-5BEE7576D414}{1EF61C9E-4455-437C-B97E-8B367ED804D4}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Explicit
Dim MyFile As String
Private Sub Commandクリア_Click()
'Text被保険者番号.Value = ""
'Text申請者氏名.Value = ""
'Textフリガナ.Value = ""
Cells(8, 4).Value = ""
Cells(10, 4).Value = ""
Cells(13, 15).Value = ""
Cells(15, 15).Value = ""
Cells(19, 15).Value = ""
Cells(20, 15).Value = ""
Cells(23, 9).Value = ""
Cells(24, 9).Value = ""
Cells(26, 10).Value = ""
'Text〒.Value = ""
'Text電話.Value = ""
'Text住所.Value = ""
'ComboBox2.Value = ""
'ComboBox3.Value = ""
'ComboBox4.Value = ""
ComboBox8.Value = ""
ComboBox9.Value = ""
ComboBox10.Value = ""
'ComboBox11.Value = ""
'ComboBox12.Value = ""
'ComboBox13.Value = ""


End Sub


Private Sub CheckBox3_Click()

    Dim n As Long
    Dim i As Long

    With Workbooks(MyFile).Worksheets("個人情報")
        ListBox1.Clear
        n = 0
        For i = 6 To .Cells(10000, 2).End(xlUp).Row
            '取得日があって離職日がないデータ
            
            If IsDate(.Cells(i, 29).Value) = True And IsDate(.Cells(i, 30).Value) = False And IsDate(.Cells(i, 13).Value) = True Then
                If CheckBox3.Value = True Then
                    If Int((Date - .Cells(i, 13).Value) / 365.25) >= 59 Then
                        ListBox1.AddItem i '行番号
                        ListBox1.List(n, 1) = .Cells(i, 5).Value & " " & .Cells(i, 6).Value
                        ListBox1.List(n, 2) = Int((Date - .Cells(i, 13).Value) / 365.25)
                        n = n + 1
                    End If
                Else
                    ListBox1.AddItem i '行番号
                    ListBox1.List(n, 1) = .Cells(i, 5).Value & " " & .Cells(i, 6).Value
                    ListBox1.List(n, 2) = Int((Date - .Cells(i, 13).Value) / 365.25)
                    n = n + 1
                End If
            End If
        Next
    End With

End Sub

Private Sub Command実行_Click()

Dim SH As Object
Dim KZ As Object
Set SH = ThisWorkbook.Worksheets("証明書")
Set KZ = Worksheets("DATA")
With Workbooks(MyFile).Worksheets("個人情報")

If ListBox1.ListIndex = -1 Then
MsgBox "リストから被保険者を選択してください。"
Else
Application.ScreenUpdating = False

Cells(8, 32).Value = .Cells(ListBox1.Value, 26).Value '雇用保険番号


Cells(10, 32).Value = KZ.Cells(66, 2).Value    '事業所番号
Cells(25, 15).Value = KZ.Cells(38, 2).Value '事業所名
If CheckBox2.Value = True Then
Cells(24, 15).Value = KZ.Cells(107, 2).Value '所在地
Else
Cells(24, 15).Value = KZ.Cells(40, 2).Value '所在地
End If
Cells(26, 15).Value = KZ.Cells(41, 2).Value & " " & KZ.Cells(42, 2).Value   '代表者

Cells(8, 35).Value = .Cells(ListBox1.Value, 29).Value '資格取得年月日
Cells(8, 45).Value = .Cells(ListBox1.Value, 13).Value '生年月日

Cells(10, 17).Value = TextBox12.Value
Cells(13, 32).Value = TextBox6.Value
Cells(15, 32).Value = TextBox7.Value
Cells(17, 32).Value = TextBox8.Value
Cells(13, 33).Value = Text1.Value
Cells(15, 33).Value = TextBox2.Value
Cells(17, 33).Value = TextBox3.Value
Cells(13, 34).Value = TextBox9.Value
Cells(15, 34).Value = TextBox10.Value
Cells(17, 34).Value = TextBox11.Value
Cells(21, 3).Value = Text11.Value
Cells(21, 11).Value = Text12.Value
Cells(21, 19).Value = Text13.Value
Cells(7, 30).Value = CheckBox1.Value




SH.Cells(2, 40).Value = .Cells(ListBox1.Value, 2).Value 'No

SH.Cells(2, 6).Value = Mid(Cells(8, 32).Text, 1, 4)    '被保険者番号
SH.Cells(2, 11).Value = Mid(Cells(8, 32).Text, 6, 6)
SH.Cells(2, 17).Value = Mid(Cells(8, 32).Text, 13, 1)

SH.Cells(3, 6).Value = Mid(Cells(10, 32).Text, 1, 4)      '事業所番号
SH.Cells(3, 11).Value = Mid(Cells(10, 32).Text, 6, 6)
SH.Cells(3, 17).Value = Mid(Cells(10, 32).Text, 13, 1)

Cells(35, 9).Value = Text銀行名.Value '追加分
Cells(34, 9).Value = Textフリガナ2.Value '追加分
Cells(37, 10).Value = Text口座番号.Value '追加分
Cells(31, 15).Value = Combo氏名.Value
Cells(30, 15).Value = .Cells(ListBox1.Value, 7).Value & " " & .Cells(ListBox1.Value, 8).Value

SH.Cells(2, 25).Value = Cells(30, 15).Value              '氏名
SH.Cells(3, 25).Value = Cells(31, 15).Value

SH.Cells(8, 13).Value = ComboBox8.Value             '60歳となった日
SH.Cells(8, 18).Value = ComboBox9.Value
SH.Cells(8, 22).Value = ComboBox10.Value

SH.Cells(8, 28).Value = Year(Cells(8, 45).Value) - 1925 '生年月日
SH.Cells(8, 30).Value = Month(Cells(8, 45).Value)
SH.Cells(8, 33).Value = Day(Cells(8, 45).Value)


SH.Cells(4, 6).Value = KZ.Cells(38, 2).Value    '名称                 '事業所データ

If CheckBox2.Value = True Then
SH.Cells(5, 6).Value = KZ.Cells(107, 2).Value   '所在地
SH.Cells(6, 6).Value = KZ.Cells(108, 2).Value '電話
Else
SH.Cells(5, 6).Value = KZ.Cells(40, 2).Value   '所在地
SH.Cells(6, 6).Value = KZ.Cells(43, 2).Value '電話
End If

SH.Cells(4, 26).Value = .Cells(ListBox1.Value, 34).Value   '〒                '申請者情報
SH.Cells(5, 26).Value = .Cells(ListBox1.Value, 35).Value   '住所
SH.Cells(6, 28).Value = .Cells(ListBox1.Value, 33).Value  '電話

If CheckBox1.Value = True Then

    With Worksheets("DATA")
    SH.Cells(10, 6).Value = .Cells(122, 2).Value '事務組合所在地
    SH.Cells(11, 6).Value = .Cells(123, 2).Value '事業所名
    SH.Cells(12, 6).Value = .Cells(124, 2).Value & " " & .Cells(125, 2).Value '代表者
    End With

Else
    If CheckBox2.Value = True Then
    SH.Cells(10, 6).Value = KZ.Cells(107, 2).Value '所在地
    Else
    SH.Cells(10, 6).Value = KZ.Cells(40, 2).Value '所在地
    End If
    
    SH.Cells(11, 6).Value = KZ.Cells(38, 2).Value '事業所名
    SH.Cells(12, 6).Value = KZ.Cells(41, 2).Value & " " & KZ.Cells(42, 2).Value '代表者

End If

SH.Cells(6, 50).Value = KZ.Cells(63, 2).Value '締日
Cells(7, 29).Value = ListBox1.ListIndex
Application.ScreenUpdating = True

Unload Me
End If
End With
Syozaiti = CheckBox2.Value
End Sub
Private Sub Text申請者氏名_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
'Textフリガナ.Text = StrConv(Application.GetPhonetic(Text申請者氏名.Text), vbNarrow)
End Sub

Private Sub ListBox1_Click()
Combo氏名.Value = ListBox1.Text
TextBox1.Value = Format(Workbooks(MyFile).Worksheets("個人情報").Cells(ListBox1.Value, 13).Value, "ggge年m月d日")

End Sub

Private Sub TextBox1_Change()
'ComboBox8.Value = Year(TextBox1.Value) + 60 - 1988
'ComboBox9.Value = Month(TextBox1.Value)
'ComboBox10.Value = Day(TextBox1.Value)
ComboBox8.Value = Year(DateAdd("d", -1, TextBox1.Value)) + 60 - 1988
ComboBox9.Value = Month(DateAdd("d", -1, TextBox1.Value))
ComboBox10.Value = Day(DateAdd("d", -1, TextBox1.Value))

End Sub

Private Sub Text銀行名_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Textフリガナ2.Text = StrConv(Application.GetPhonetic(Text銀行名.Text), vbNarrow)
End Sub
Private Sub UserForm_Initialize()
    CheckBox2.Value = Syozaiti
    MyFile = Worksheets("DATA").Cells(1, 1).Value
    
    
    Dim SH As Object
    Set SH = Worksheets("証明書")
    CheckBox3.Value = True
    
    TextBox1.Value = Format(Cells(8, 45).Value, "ggge年m月d日")
    ComboBox8.List = Range(Cells(111, 1), Cells(174, 1)).Value
    ComboBox9.List = Range(Cells(111, 1), Cells(122, 1)).Value
    ComboBox10.List = Range(Cells(111, 1), Cells(141, 1)).Value
    
    ComboBox8.Value = SH.Cells(8, 13).Value
    ComboBox9.Value = SH.Cells(8, 18).Value
    ComboBox10.Value = SH.Cells(8, 22).Value
    TextBox12.Value = Cells(10, 17).Value
    TextBox6.Value = Cells(13, 32).Value
    TextBox7.Value = Cells(15, 32).Value
    TextBox8.Value = Cells(17, 32).Value
    Text1.Value = Cells(13, 33).Value
    TextBox2.Value = Cells(15, 33).Value
    TextBox3.Value = Cells(17, 33).Value
    TextBox9.Value = Cells(13, 34).Value
    TextBox10.Value = Cells(15, 34).Value
    TextBox11.Value = Cells(17, 34).Value
    Text11.Value = Cells(21, 3).Value
    Text12.Value = Cells(21, 11).Value
    Text13.Value = Cells(21, 19).Value
    If Cells(7, 30).Value = "" Then
        CheckBox1.Value = False
        Else
        CheckBox1.Value = Cells(7, 30).Value
    End If
    
    Combo氏名.Value = Cells(31, 15).Value
    Text銀行名.Value = Cells(35, 9).Value
    Textフリガナ2.Value = Cells(34, 9).Value
    Text口座番号.Value = Cells(37, 10).Value
    On Error Resume Next
    ListBox1.ListIndex = Cells(7, 29).Value
    

End Sub



Attribute VB_Name = "フォーム個人データ"
Attribute VB_Base = "0{941B1549-0A04-4D35-A177-B2F8AC4FA366}{4F74E3AB-0051-4B7A-B6A9-2B016CAAA757}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Explicit
Dim KO As Object

Private Sub CommandButton1_Click()
    Dim da As String
    Dim 氏名 As String
    Dim 行 As Long
    Dim i As Long
    
    da = Worksheets("DATA").Cells(1, 1).Value

    With Workbooks(da).Worksheets("個人情報")
        If OptionButton2.Value = True Then
        氏名 = Worksheets("登録届").Cells(31, 15).Value
        ElseIf OptionButton1.Value = True Then
        氏名 = Worksheets("登録届新").Cells(40, 23).Value
'20110926 kon
        Else
        氏名 = Worksheets("登録届1230").Cells(40, 23).Value
        End If
        行 = 0
        For i = 6 To .Cells(10000, 2).End(xlUp).Row
            If 氏名 = .Cells(i, 5).Value & " " & .Cells(i, 6).Value Then
                行 = i
                Exit For
            End If
        Next
        If 行 = 0 Then
            MsgBox "このデータは適用できません。", 16, "氏名がありません。"
            Exit Sub
        End If
        
        Text事業所名.Value = Workbooks(da).Worksheets("会社情報").Cells(8, 2).Value
        Text被保険者名.Value = 氏名
        Text被保険者番号.Value = .Cells(行, 26).Value
        Text生年月日.Value = Format(.Cells(行, 13).Value, "GEE/MM/DD")
        Text取得日.Value = Format(.Cells(行, 29).Value, "GEE/MM/DD")
        Text到達日.Value = Format(DateAdd("yyyy", 60, .Cells(行, 13).Value - 1), "GEE/MM/DD")
        Text到達賃金.Value = ""
        Text85.Value = ""
        Combo申請月.Value = ""
        If OptionButton2.Value = True Then
        Text金融機関.Value = IIf(Trim(Worksheets("登録届").Cells(35, 9).Value) = "", "", Worksheets("登録届").Cells(35, 9).Value & " No." & Worksheets("登録届").Cells(37, 10).Value)
        ElseIf OptionButton1.Value = True Then
        Text金融機関.Value = IIf(Trim(Worksheets("登録届新").Cells(44, 10).Value) = "", "", Worksheets("登録届新").Cells(44, 10).Value & " No." & Worksheets("登録届新").Cells(46, 12).Value)
'20110926 kon
        Else
        Text金融機関.Value = IIf(Trim(Worksheets("登録届1230").Cells(44, 10).Value) = "", "", Worksheets("登録届1230").Cells(44, 10).Value & " No." & Worksheets("登録届1230").Cells(46, 12).Value)
        End If
        
        Textメモ.Value = ""
        Text代表者.Value = Workbooks(da).Worksheets("会社情報").Cells(11, 2).Value & " " & Workbooks(da).Worksheets("会社情報").Cells(12, 2).Value
        Text事業所番号.Value = Workbooks(da).Worksheets("会社情報").Cells(36, 2).Value
        Text所在地.Value = Workbooks(da).Worksheets("会社情報").Cells(10, 2).Value
    End With
End Sub

Private Sub Command更新_Click()
On Error GoTo errorcheck
If Text事業所名.Value = "" Then
 MsgBox "事業所名が入力されていません", , "未入力"
  Else
    Dim msg As Integer
    msg = MsgBox("このデータを" & Command更新.Caption & "しますか?", 1 + 32, Command更新.Caption)
     If msg = 1 Then
       ToCell (ScrollBar1.Value + 5)
      If ScrollBar1.Value = ScrollBar1.Max Then
       ScrollBar1.Max = KO.Range("C5").CurrentRegion.Rows.Count
      End If
   MsgBox Command更新.Caption & "しました"
ScrollBar1_Change
   End If

End If
Text被保険者名.SetFocus
Exit Sub
errorcheck:
Select Case Err
   Case 1004
   MsgBox "年月日の入力が正しくありません", , "エラー"
   Case 13
   MsgBox "年月日の入力が正しくありません", , "エラー"

   Case Else
   MsgBox Error(Err), , "エラー"
End Select
End Sub

Private Sub Command削除_Click()
    Dim msg As Integer
   msg = MsgBox("このデータを削除してもいいですか?", 1 + 32, "削除")
   If msg = 1 Then
   KO.Range(KO.Cells(ScrollBar1.Value + 5, 2), KO.Cells(ScrollBar1.Value + 5, 15)).Delete Shift:=xlUp '削除範囲がずれていた。4/30
   ScrollBar1_Change
MsgBox "削除しました", , "削除"
End If
Text被保険者名.SetFocus
End Sub
Private Sub Command新規_Click()
ScrollBar1.Value = ScrollBar1.Max
Label15.Caption = "新規"
End Sub

Private Sub ScrollBar1_Change()
  ScrollBar1.Max = KO.Range("B5").CurrentRegion.Rows.Count
  ToTextBox (ScrollBar1.Value + 5)
    If ScrollBar1.Value = ScrollBar1.Max Then
        Command更新.Caption = "登録"
         Label15.Caption = "新規"
    Me.Height = 366

    Else
      Label15.Caption = ScrollBar1.Value & "/" & ScrollBar1.Max - 1
      Command更新.Caption = "変更"
    Me.Height = 322
    End If
End Sub
Private Sub UserForm_Initialize()
      
      Set KO = Workbooks("雇用継続個人データ.xls").Worksheets("個人データ")
      ScrollBar1.Max = KO.Range("B6").CurrentRegion.Rows.Count
      ScrollBar1.Min = 1
      ScrollBar1.Value = 1
      Combo申請月.AddItem "偶数月"
      Combo申請月.AddItem "奇数月"
Application.ScreenUpdating = True
End Sub
Sub ToTextBox(行位置 As Long)
    
    
    Text事業所名.Value = KO.Cells(行位置, 2).Value
    Text被保険者名.Value = KO.Cells(行位置, 3).Value
    Text被保険者番号.Value = KO.Cells(行位置, 4).Value
    Text生年月日.Value = Format(KO.Cells(行位置, 5).Value, "GEE/MM/DD")
    Text取得日.Value = Format(KO.Cells(行位置, 6).Value, "GEE/MM/DD")
    Text到達日.Value = Format(KO.Cells(行位置, 7).Value, "GEE/MM/DD")
    Text到達賃金.Value = KO.Cells(行位置, 8).Value
    Text85.Value = KO.Cells(行位置, 9).Value
    Combo申請月.Value = KO.Cells(行位置, 10).Value
    Text金融機関.Value = KO.Cells(行位置, 11).Value
    Textメモ.Value = KO.Cells(行位置, 12).Value
    Text代表者.Value = KO.Cells(行位置, 13).Value
Text事業所番号.Value = KO.Cells(行位置, 14).Value
Text所在地.Value = KO.Cells(行位置, 15).Value
End Sub
Sub ToCell(行位置 As Long)
  
    KO.Cells(行位置, 2).Value = Text事業所名.Value
    KO.Cells(行位置, 3).Value = Text被保険者名.Value
    KO.Cells(行位置, 4).Value = Text被保険者番号.Value
KO.Cells(行位置, 5).Value = DateValue(Text生年月日.Value)
KO.Cells(行位置, 6).Value = DateValue(Text取得日.Value)
KO.Cells(行位置, 7).Value = DateValue(Text到達日.Value)
    KO.Cells(行位置, 8).Value = Text到達賃金.Value
    KO.Cells(行位置, 9).Value = Text85.Value
    KO.Cells(行位置, 10).Value = Combo申請月.Value
    KO.Cells(行位置, 11).Value = Text金融機関.Value
    KO.Cells(行位置, 12).Value = Textメモ.Value
KO.Cells(行位置, 13).Value = Text代表者.Value
KO.Cells(行位置, 14).Value = Text事業所番号.Value
KO.Cells(行位置, 15).Value = Text所在地.Value



End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If Workbooks("雇用継続個人データ.xls").Saved = False Then
Workbooks("雇用継続個人データ.xls").Save
End If
Workbooks("雇用継続個人データ.xls").Close
End Sub

Attribute VB_Name = "フォーム申請書"
Attribute VB_Base = "0{6E1C6BB2-6685-457D-8A11-21899688CE3B}{E7A9437B-70A8-4392-ABEC-42B20636A84E}"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Attribute VB_TemplateDerived = False
Attribute VB_Customizable = False
Option Explicit
Dim MyFile  As String
Dim i As Integer
Dim n As Integer

Private Sub CheckBox3_Click()
    With Workbooks(MyFile).Worksheets("個人情報")
        ListBox1.Clear
        n = 0
        For i = 6 To .Cells(10000, 2).End(xlUp).Row
            '取得日があって離職日がないデータ
            
            If IsDate(.Cells(i, 29).Value) = True And IsDate(.Cells(i, 30).Value) = False And IsDate(.Cells(i, 13).Value) = True Then
                If CheckBox3.Value = True Then
                    If Int((Date - .Cells(i, 13).Value) / 365.5) >= 59 Then
                        ListBox1.AddItem i '行番号
                        ListBox1.List(n, 1) = .Cells(i, 5).Value & " " & .Cells(i, 6).Value
                        ListBox1.List(n, 2) = Int((Date - .Cells(i, 13).Value) / 365.5)
                        n = n + 1
                    End If
                Else
                    ListBox1.AddItem i '行番号
                    ListBox1.List(n, 1) = .Cells(i, 5).Value & " " & .Cells(i, 6).Value
                    ListBox1.List(n, 2) = Int((Date - .Cells(i, 13).Value) / 365.5)
                    n = n + 1
                End If
            End If
        Next
    End With

End Sub
Private Sub CommandButton11_Click()
        Dim hwnd As Long, Ret As Long
        Dim getforgroundwindow As Long
        hwnd = getforgroundwindow
        Ret = ShellExecute(hwnd, "Open", Te32.Value, "", "", 5)
End Sub
Private Sub CommandButton12_Click()
        Dim strFName As String
        strFName = _
            Application.GetOpenFilename _
                 ("(*.*),*.*")
        If (strFName = "False") Then
            Exit Sub
        End If
        Te32.Value = strFName
    
        
End Sub

Private Sub Commandクリア_Click()
Cells(19, 3).Value = ""
Cells(19, 11).Value = ""
Cells(19, 19).Value = ""
Cells(12, 35).Value = ""
Cells(14, 35).Value = ""
Cells(16, 35).Value = ""
Text被保険者番号.Value = ""
TextBox1.Value = ""
TextBox2.Value = ""
ComboBox4.Value = ""
ComboBox5.Value = ""
ComboBox8.Value = ""
Text住所.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
'20100611 kon
ComboBox2.Value = ""
ComboBox3.Value = ""
ComboBox6.Value = ""
ComboBox7.Value = ""
ComboBox9.Value = ""
ComboBox10.Value = ""




End Sub


Private Sub Command実行_Click()
Call 登録
Unload Me

End Sub
Sub 登録()
Syozaiti = CheckBox2.Value

With Workbooks(MyFile).Worksheets("個人情報")
If ListBox1.ListIndex = -1 Then
MsgBox "申請者が選択されていません"
Else
Cells(12, 3).Value = Mid(ComboBox2.Value, 1, 1)
Cells(12, 4).Value = Mid(ComboBox2.Value, 2, 1)
Cells(12, 5).Value = Mid(ComboBox3.Value, 1, 1)
Cells(12, 6).Value = Mid(ComboBox3.Value, 2, 1)

Cells(14, 3).Value = Mid(ComboBox6.Value, 1, 1)
Cells(14, 4).Value = Mid(ComboBox6.Value, 2, 1)
Cells(14, 5).Value = Mid(ComboBox7.Value, 1, 1)
Cells(14, 6).Value = Mid(ComboBox7.Value, 2, 1)

Cells(16, 3).Value = Mid(ComboBox9.Value, 1, 1)
Cells(16, 4).Value = Mid(ComboBox9.Value, 2, 1)
Cells(16, 5).Value = Mid(ComboBox10.Value, 1, 1)
Cells(16, 6).Value = Mid(ComboBox10.Value, 2, 1)

Cells(12, 16).Value = Mid(ComboBox4.Value, 1, 1)
Cells(12, 17).Value = Mid(ComboBox4.Value, 2, 1)
Cells(14, 16).Value = Mid(ComboBox5.Value, 1, 1)
Cells(14, 17).Value = Mid(ComboBox5.Value, 2, 1)
Cells(16, 16).Value = Mid(ComboBox8.Value, 1, 1)
Cells(16, 17).Value = Mid(ComboBox8.Value, 2, 1)
    
Cells(19, 3).Value = Text住所.Value '追加分
Cells(19, 11).Value = TextBox3.Value
Cells(19, 19).Value = TextBox4.Value


Cells(12, 35).Value = Text被保険者番号.Value
Cells(14, 35).Value = TextBox1.Value
Cells(16, 35).Value = TextBox2.Value

'20090603masaya
Cells(3, 30).Value = Te32.Value

   
   Range("H12:N12,H14:N14,H16:N16").FormulaR1C1 = _
        "=IF(OR(RC35=0,(LEN(TEXT(RC35,0))-R1C)<=0),"""",MID(TEXT(RC35,0),LEN(TEXT(RC35,0))-R1C,1))"
 Range("H12:N16").Value = Range("H12:N16").Value
Cells(7, 3).Value = .Cells(ListBox1.Value, 26).Value '被保険者番号
Cells(7, 12).Value = .Cells(ListBox1.Value, 29).Value '取得年月日
    With Worksheets("DATA")
    Cells(9, 5).Value = .Cells(66, 2).Value '事業所番号
    If CheckBox2.Value = True Then
    Cells(21, 17).Value = .Cells(107, 2).Value  '所在地
    Else
    Cells(21, 17).Value = .Cells(40, 2).Value  '所在地
    End If

    Cells(22, 19).Value = .Cells(38, 2).Value '事業所名
    Cells(23, 19).Value = .Cells(41, 2).Value & " " & .Cells(42, 2).Value '事業主
    End With
Cells(7, 19).Value = Label37.Caption
Cells(24, 19).Value = Label37.Caption
Cells(7, 29).Value = ListBox1.ListIndex
End If
End With
End Sub
Private Sub Image1_Click()
    If Te32.Value = "" Then
        MsgBox "委任状が登録されていません。", 16, "e-Gov"
        Exit Sub
    End If
    
    Call 登録
    
    Application.ScreenUpdating = False
   
    Workbooks.Open ThisWorkbook.Path & "\雇用保険電子申請ツール\雇用継続支給申請XMLデータ作成.xls"
    
    Worksheets("DATA").Cells(1, 1).Value = ThisWorkbook.Worksheets("DATA").Cells(1, 1).Value
    Worksheets("DATA").Cells(8, 2).Value = ThisWorkbook.Path
    Worksheets("DATA").Cells(12, 2).Value = Te32.Value
    Unload Me
    Application.Run ActiveWorkbook.Name & "!初期処理"
    ThisWorkbook.Activate
    End Sub

Private Sub ListBox1_Click()
Label37.Caption = ListBox1.Text
End Sub

Private Sub UserForm_Initialize()
CheckBox2.Value = Syozaiti
MyFile = Worksheets("DATA").Cells(1, 1).Value
CheckBox3.Value = True
'20090610 kon
'ComboBox2.List = Range(Cells(113, 1), Cells(164, 1)).Value '年月
ComboBox2.List = Range(Cells(120, 1), Cells(164, 1)).Value '年月
ComboBox3.List = Range(Cells(101, 1), Cells(112, 1)).Value
'ComboBox6.List = Range(Cells(113, 1), Cells(164, 1)).Value
ComboBox6.List = Range(Cells(120, 1), Cells(164, 1)).Value
ComboBox7.List = Range(Cells(101, 1), Cells(112, 1)).Value
'ComboBox9.List = Range(Cells(113, 1), Cells(164, 1)).Value
ComboBox9.List = Range(Cells(120, 1), Cells(164, 1)).Value
ComboBox10.List = Range(Cells(101, 1), Cells(112, 1)).Value

ComboBox4.List = Range(Cells(101, 1), Cells(131, 1)).Value '賃金減額日数
ComboBox5.List = Range(Cells(101, 1), Cells(131, 1)).Value
ComboBox8.List = Range(Cells(101, 1), Cells(131, 1)).Value

Text被保険者番号.Value = Cells(12, 35).Value '支払われた賃金
TextBox1.Value = Cells(14, 35).Value
TextBox2.Value = Cells(16, 35).Value

 Text住所.Value = Cells(19, 3).Value '特記事項
TextBox3.Value = Cells(19, 11).Value
TextBox4.Value = Cells(19, 19).Value


ComboBox2.Value = Cells(12, 3).Value & Cells(12, 4).Value
ComboBox3.Value = Cells(12, 5).Value & Cells(12, 6).Value
ComboBox6.Value = Cells(14, 3).Value & Cells(14, 4).Value
ComboBox7.Value = Cells(14, 5).Value & Cells(14, 6).Value
ComboBox9.Value = Cells(16, 3).Value & Cells(16, 4).Value
ComboBox10.Value = Cells(16, 5).Value & Cells(16, 6).Value
ComboBox4.Value = Cells(12, 16).Value & Cells(12, 17).Value
ComboBox5.Value = Cells(14, 16).Value & Cells(14, 17).Value
ComboBox8.Value = Cells(16, 16).Value & Cells(16, 17).Value

'20090603masaya
Te32.Value = Cells(3, 30).Value

On Error Resume Next
ListBox1.ListIndex = Cells(7, 29).Value

End Sub


Attribute VB_Name = "Module1"
Option Explicit
'修正履歴
'証明書に住所を持ってこない等 20100531 kon
'保存名のエラー 20100601 kon
'クリアされない 20100611 kon
 'Excelのバージョンによって保存でエラーになるため  20100802 kon

Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" ( _
    ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
   lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
   lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
   ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
   ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
   lpStartupInfo As STARTUPINFO, lpProcessInformation As _
   PROCESS_INFORMATION) As Long
   
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
   hHandle As Long, ByVal dwMilliseconds As Long) As Long
   
Private Type PROCESS_INFORMATION
   hProcess As Long
   hThread As Long
   dwProcessID As Long
   dwThreadID As Long
End Type
Private Type STARTUPINFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
…