Malicious Office (OLE) — malware analysis report

Static analysis result for SHA-256 eb4b45216c9b1be0…

MALICIOUS

Office (OLE)

335.0 KB Created: 2009-05-27 09:00:28 Authoring application: Microsoft Excel First seen: 2018-07-18
MD5: c4246b634f3f8beb543e9ec3a7b7f43b SHA-1: 303a6d8297fcbf9278bba43885ea6a405b164c4e SHA-256: eb4b45216c9b1be044704ace227f5da8c526bd10b7e188a656dba86afca880e2
102 Risk Score

Malware Insights

MITRE ATT&CK
T1059.005 Visual Basic T1203 Exploitation for Client Execution

The sample is an Excel document containing VBA macros that heavily reference Windows API functions such as CreateProcess and ShellExecute, indicating an intent to execute external code. While the document body contains Japanese text related to employment conditions, the presence of these API calls suggests a malicious purpose beyond displaying document content. The embedded URL, though marked as benign, is included as a potential IOC.

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://get.adobe.com/jp/reader/ 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) 48007 bytes
SHA-256: f4f38479c2e4751cb433ea479813f1003d062a93e90829e1dcdecbee3179d9b5
Preview script
First 1,000 lines of the extracted script
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
Option Explicit


Attribute VB_Name = "Sheet3"
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 = "Sheet31"
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

Private Sub TextBox1_Change()
ActiveSheet.PageSetup.TopMargin = Application.InchesToPoints(Cells(10, 39).Value / 3)
        
End Sub

Private Sub TextBox2_Change()
ActiveSheet.PageSetup.LeftMargin = Application.InchesToPoints(Cells(10, 40).Value / 3)
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

End Sub

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)
    ThisWorkbook.Saved = True
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    MsgBox "このファイルは保存できません。", 16, AAA
    Cancel = True
End Sub


Attribute VB_Name = "選択"
Attribute VB_Base = "0{5FA3F863-016B-4044-BF6E-66F7B4A1980E}{86539B2B-6220-43EE-A477-49614073F739}"
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

Private MyFile As String
Private Sub CheckBox2_Click()
    '20081202 kon
    If CheckBox2.Value = True Then
        CheckBox5.Enabled = True
        
        '20100301masa
        CheckBox6.Enabled = True
        
    Else
        CheckBox5.Enabled = False
        CheckBox5.Value = False
        
        '20100301masa
        CheckBox6.Enabled = False
        CheckBox6.Value = False
        CheckBox9.Enabled = False
        CheckBox9.Value = False
        
    End If
End Sub
Private Sub CheckBox6_Click()
    '201002
    If CheckBox6.Value = True Then
       CheckBox9.Enabled = True
    Else
        CheckBox9.Enabled = False
        CheckBox9.Value = False
    End If
End Sub
Private Sub CommandButton2_Click()
    
    If ListBox1.ListIndex = -1 Then
        MsgBox "リストを選択してください。", 16, AAA
        Exit Sub
    End If
    
    Application.Calculation = xlCalculationManual
    
    Cells(1, 1).Value = Val(ListBox1.Value)
    Cells(11, 21).Value = ComboBox1.Value
    Cells(11, 21).Value = ComboBox1.Value
    Cells(21, 4).Value = ComboBox2.Value
    Cells(21, 11).Value = ComboBox3.Value
    Cells(21, 21).Value = ComboBox5.Value
    Cells(21, 25).Value = ComboBox4.Value
    Cells(21, 30).Value = TextBox1.Value '賃金
    Cells(23, 30).Value = CheckBox2.Value '契約期間の定め
    Cells(31, 30).Value = CheckBox3.Value '事務組合
     
    Cells(19, 32).Value = CheckBox3.Value
    'H20080604 masaya
    Cells(28, 22).Value = TextBox3.Value
    Cells(29, 22).Value = TextBox4.Value
    Cells(30, 22).Value = TextBox5.Value
    Cells(30, 25).Value = TextBox6.Value
    Cells(30, 27).Value = TextBox7.Value
    Cells(31, 24).Value = ComboBox6.Value
    
    If CheckBox4.Value = True Then
       Cells(32, 27).Value = "レ"
       Else
       Cells(32, 27).Value = ""
    End If
    Cells(33, 19).Value = TextBox8.Value
    
    '契約期間       20080807 kon
    '開始
    Cells(28, 30).Value = TextBox9.Value
    Cells(28, 31).Value = TextBox10.Value
    Cells(28, 32).Value = TextBox11.Value
    '終了
    Cells(29, 30).Value = TextBox12.Value
    Cells(29, 31).Value = TextBox13.Value
    Cells(29, 32).Value = TextBox14.Value
    
    '契約更新条項の有無
    
'20081202 kon
'    If CheckBox5.Value = True Then
'        Cells(30, 30).Value = "TRUE"
'    ElseIf CheckBox5.Value = False Then
'        Cells(30, 30).Value = "FALSE"
'    End If
    If CheckBox2.Value = True Then
        If CheckBox5.Value = True Then
            Cells(30, 30).Value = "TRUE"
        ElseIf CheckBox5.Value = False Then
            Cells(30, 30).Value = "FALSE"
        End If
    Else
        Cells(30, 30).Value = ""
    End If
    If CheckBox2.Value = True Then
        If CheckBox6.Value = True Then
            Cells(30, 31).Value = True
                If CheckBox9.Value = True Then
                    Cells(31, 31).Value = True
                ElseIf CheckBox9.Value = False Then
                    Cells(31, 31).Value = False
                End If
        ElseIf CheckBox6.Value = False Then
            Cells(30, 31).Value = False
            Cells(31, 31).Value = False
        End If
    Else
        Cells(30, 31).Value = ""
'        Cells(31, 31).Value = ""
    End If
    
    '事業所名
    Cells(30, 32).Value = TextBox15.Value
'20081202 kon
'    Cells(23, 8).Value = TextBox16.Value
    
    Cells(23, 8).Value = TextBox16.Value
    Cells(23, 10).Value = TextBox17.Value
    Cells(19, 32).Value = CheckBox7.Value
    

''' YBNO18519
'35行目に提出年月日を入れる
    Cells(35, 31).Value = Me.txtApplyYear.Text
    Cells(35, 32).Value = Me.txtApplyMonth.Text
    Cells(35, 33).Value = Me.txtApplyDay.Text
''' END 18519

    Unload Me
End Sub

Private Sub CommandButton3_Click()
    If ListBox1.ListIndex = -1 Then
        MsgBox "被保険者を選択してから実行してください。", 16, "選択"
        Exit Sub
    End If
    氏名変更.Show
End Sub
Private Sub CommandButton4_Click()
    
    Dim i As Long
    Dim n As Long
    
    If Trim(TextBox18.Value) = "" Then '20130102 titti 要望 #20098
        MsgBox "検索文字を入力してから実行してください。", 16, "検索"
        Exit Sub
    End If
    If OptionButton2.Value = False Then
        OptionButton2.Value = True
    End If

    ListBox2.Clear
    n = 0
    For i = 0 To ListBox1.ListCount - 1
        If ListBox1.List(i, 3) Like "*" & TextBox18.Value & "*" Then
            ListBox2.AddItem i
            ListBox2.List(n, 1) = ListBox1.List(i, 3)
            n = n + 1
        End If
    Next
    If n = 0 Then
        MsgBox "「" & TextBox18.Value & "」は見つかりませんでした。", 16, "検索"
        Else
        ListBox2.ListIndex = 0
    End If

End Sub
Private Sub ListBox1_Click()
    With Workbooks(MyFile).Worksheets("個人情報")
    '------------------------------------------------------------------------------
    '雅也修正(171201)'修正前 TextBox1.Value = .Cells(ListBox1.ListIndex + 6, 21).Value '健保の標準報酬月額
      
    '20081201 kon
    '  TextBox1.Value = Int(.Cells(ListBox1.ListIndex + 6, 121).Value / 1000) '標準報酬額
    TextBox1.Value = Int(.Cells(ListBox1.List(ListBox1.ListIndex, 4), 121).Value / 1000) '標準報酬額
    
    
    '------------------------------------------------------------------------------
    End With
End Sub
Private Sub ListBox2_Click()
    
    ListBox1.ListIndex = Val(ListBox2.Value)

End Sub
Private Sub OptionButton1_Click()
        
    '直近の取得者
    ListBox1.Clear
    
    Dim i As Long
    Dim n As Integer
    n = 0
    With Workbooks(MyFile).Worksheets("個人情報")
        For i = 6 To .Cells(10000, 2).End(xlUp).Row 'No.の最後の行
            If IsDate(.Cells(i, 29).Value) = True And IsDate(.Cells(i, 30).Value) = False Then
                If .Cells(i, 29).Value >= Date - 50 Then
                        ListBox1.AddItem i - 5 '従来の関係から(6行目を1とする)
                        ListBox1.List(n, 1) = IIf(.Cells(i, 30).Value > 0, "×", " ") '20130101 titti この列を非表示とする
                        ListBox1.List(n, 2) = .Cells(i, 29).Text     '取得日
                        ListBox1.List(n, 3) = .Cells(i, 5).Value & " " & .Cells(i, 6).Value '氏名
                        '20081201 kon
                        ListBox1.List(n, 4) = i
                        n = n + 1
                End If
            End If
        Next
    End With
End Sub
Private Sub OptionButton2_Click()
    'すべて
    ListBox1.Clear
    Dim n As Integer
    Dim i As Long
    n = 0
    With Workbooks(MyFile).Worksheets("個人情報")
        For i = 6 To .Cells(10000, 2).End(xlUp).Row 'No.の最後の行
            If IsDate(.Cells(i, 29).Value) = True And IsDate(.Cells(i, 30).Value) = False Then
                ListBox1.AddItem i - 5 '従来の関係から(6行目を1とする)
                ListBox1.List(n, 1) = IIf(.Cells(i, 30).Value > 0, "×", " ")
                ListBox1.List(n, 2) = .Cells(i, 29).Text     '取得日
                ListBox1.List(n, 3) = .Cells(i, 5).Value & " " & .Cells(i, 6).Value '氏名
                '20081201 kon
                ListBox1.List(n, 4) = i
                n = n + 1
            End If
        Next
    End With
End Sub
Private Sub UserForm_Initialize()

    MyFile = Worksheets("DATA").Cells(1, 1).Value '読み込まれた台帳ファイル名
    OptionButton1.Value = True
    On Error Resume Next '前回のデータを反映させるため
    ListBox1.ListIndex = Cells(1, 1).Value - 1
    On Error GoTo 0
    ComboBox1.AddItem "1"
    ComboBox1.List(0, 1) = "1 新規"
    ComboBox1.AddItem "2"
    ComboBox1.List(1, 1) = "2 再取得"
    ComboBox1.Value = IIf(Cells(11, 21).Value = "", 2, Cells(11, 21).Value)
    
    ComboBox2.AddItem "1"
    ComboBox2.List(0, 1) = "1 新規雇用(学卒)"
    ComboBox2.AddItem "2"
    ComboBox2.List(1, 1) = "2 新規雇用(その他)"
    ComboBox2.AddItem "3"
    ComboBox2.List(2, 1) = "3 日雇からの切替"
    ComboBox2.AddItem "4"
    ComboBox2.List(3, 1) = "4 その他"
    ComboBox2.AddItem "8"
    ComboBox2.List(4, 1) = "8 出向元への復帰"
    ComboBox2.Value = IIf(Cells(21, 4).Value = "", 2, Cells(21, 4).Value)
    
    ComboBox3.AddItem "1"
    ComboBox3.List(0, 1) = "1 月給"
    ComboBox3.AddItem "2"
    ComboBox3.List(1, 1) = "2 週給"
    ComboBox3.AddItem "3"
    ComboBox3.List(2, 1) = "3 日給"
    ComboBox3.AddItem "4"
    ComboBox3.List(3, 1) = "4 時間給"
    ComboBox3.AddItem "5"
    ComboBox3.List(4, 1) = "5 その他"
    ComboBox3.Value = IIf(Cells(21, 11).Value = "", 1, Cells(21, 11).Value)
    '20090416 kon
    ComboBox5.AddItem "1"
    ComboBox5.List(0, 1) = "1 日雇"
    ComboBox5.AddItem "2"
    '20110408 kon
    'ComboBox5.List(1, 1) = "2 登録型派遣労働者"
    ComboBox5.List(1, 1) = "2 派遣"
    ComboBox5.AddItem "3"
    '20110408 kon
    'ComboBox5.List(2, 1) = "3 短時間就労者"
    ComboBox5.List(2, 1) = "3 パートタイム"
    ComboBox5.AddItem "4"
    ComboBox5.List(3, 1) = "4 有期契約労働者"  '20090409雅也修正
    ComboBox5.AddItem "5"
    ComboBox5.List(4, 1) = "5 季節的雇用"
    '20110408 kon
    ComboBox5.AddItem "6"
    ComboBox5.List(5, 1) = "6 船員"
    
    ComboBox5.AddItem "7"
    '20110408 kon
    'ComboBox5.List(5, 1) = "7 その他"
    ComboBox5.List(6, 1) = "7 その他"
    ComboBox5.Value = IIf(Cells(21, 21).Value = "", 7, Cells(21, 21).Value)
    
    ComboBox4.AddItem "1"
    ComboBox4.List(0, 1) = "1 専門的技術的職業"
    ComboBox4.AddItem "2"
    ComboBox4.List(1, 1) = "2 管理的職業"
    ComboBox4.AddItem "3"
    ComboBox4.List(2, 1) = "3 事務的職業"
    ComboBox4.AddItem "4"
    ComboBox4.List(3, 1) = "4 販売の職業"
    ComboBox4.AddItem "5"
    ComboBox4.List(4, 1) = "5 サービスの職業"
    ComboBox4.AddItem "6"
    ComboBox4.List(5, 1) = "6 保安の職業"
    ComboBox4.AddItem "7"
    ComboBox4.List(6, 1) = "7 農林漁業の職業"
    ComboBox4.AddItem "8"
    ComboBox4.List(7, 1) = "8 運輸通信の職業"
    ComboBox4.AddItem "9"
    ComboBox4.List(8, 1) = "9 生産工程、労務の職業"
    ComboBox4.Value = IIf(Cells(21, 25).Value = "", 9, Cells(21, 25).Value)
    
    ComboBox6.AddItem "有"
    ComboBox6.AddItem "無"
    
     'H20080604 masaya
        TextBox3.Value = Cells(28, 22).Value
        TextBox4.Value = Cells(29, 22).Value
        TextBox5.Value = Cells(30, 22).Value
        TextBox6.Value = Cells(30, 25).Value
        TextBox7.Value = Cells(30, 27).Value
        ComboBox6.Value = Cells(31, 24).Value
        If Cells(32, 27).Value = "" Then
            CheckBox4.Value = False
           Else
           CheckBox4.Value = True
        End If
        TextBox8.Value = Cells(33, 19).Value
    '20081022 kon
        TextBox9.Value = Cells(28, 30).Value
        TextBox10.Value = Cells(28, 31).Value
        TextBox11.Value = Cells(28, 32).Value
        TextBox12.Value = Cells(29, 30).Value
        TextBox13.Value = Cells(29, 31).Value
        TextBox14.Value = Cells(29, 32).Value
        '契約更新条項の有無
        
        If Cells(30, 30).Value = True Then
            CheckBox5.Value = True
        ElseIf Cells(30, 30).Value = False Then
            CheckBox5.Value = False
        End If
        
        '半年年以上使用する見込みの有無
        If Cells(30, 31).Value = True Then
            CheckBox6.Value = True
        ElseIf Cells(30, 31).Value = False Then
            CheckBox6.Value = False
        End If
        '20100301masa
        '半年年以上使用する見込みの有無
        If Cells(31, 31).Value = True Then
            CheckBox9.Value = True
        ElseIf Cells(31, 31).Value = False Then
            CheckBox9.Value = False
        End If
        
    CheckBox7.Value = Cells(19, 32).Value '予備の事業所番号
    TextBox1.Value = Cells(21, 30).Value '賃金
    CheckBox2.Value = IIf(Cells(23, 30).Value = "", True, Cells(23, 30).Value) '契約期間の定め
    CheckBox3.Value = IIf(Cells(31, 30).Value = "", True, Cells(31, 30).Value) '事務組合
    
    TextBox15.Value = Worksheets("DATA").Cells(38, 2).Value
    TextBox16.Value = Left(Cells(23, 31).Value, 2)
    TextBox17.Value = Right(Cells(23, 31).Value, 2)
    
        '20081202 kon
        If CheckBox2.Value = True Then
            CheckBox5.Enabled = True
            CheckBox6.Enabled = True
        Else
            CheckBox5.Enabled = False
            CheckBox5.Value = False
            CheckBox6.Enabled = False
            CheckBox6.Value = False
            '20100301masaya
            CheckBox9.Enabled = False
            CheckBox9.Value = False
        End If
    
    '''YBNO 18519
        Dim NowDate As Date
        
        NowDate = Now
        
        If Cells(35, 31).Value <> vbNullString And IsNumeric(Cells(35, 31).Value) Then
            Me.txtApplyYear.Text = Cells(35, 31).Value
        Else
            Me.txtApplyYear.Text = Year(NowDate) - 1988
        End If
        If Cells(35, 32).Value <> vbNullString And IsNumeric(Cells(35, 32).Value) Then
            Me.txtApplyMonth.Text = Cells(35, 32).Value
        Else
            Me.txtApplyMonth.Text = Month(NowDate)
        End If
        If Cells(35, 33).Value <> vbNullString And IsNumeric(Cells(35, 33).Value) Then
            Me.txtApplyDay.Text = Cells(35, 33).Value
        Else
            Me.txtApplyDay.Text = Day(NowDate)
        End If
                
    '''END YBNO 18519
    
    Application.ScreenUpdating = True
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    
    Application.Calculation = xlCalculationAutomatic

End Sub

Attribute VB_Name = "Module1"
'*************************************************************************
'       修整履歴
'       代行印が2007でエラーになるため                    20070209 kon
'       直近の取得者の時に賃金月額が正しく表示しないため 20081201 kon
'       期間の定めのない場合は契約更新条項の有無・1年以上使用する見込みの有無は空に      20081202 kon
'       派遣とパートが逆だった 20090416 kon
'       用紙変更(2010.6)のため 20100830 kon
'       用紙追加(2011.01)のため                   20110408 kon
'       社会保険労務士記載欄を初めから提出代行者を表示するように変更 20110512 kon
'       事業所名・ハローワーク名を印刷するしないを切り替え              20110512  kon
'*************************************************************************


Option Explicit
Public Const AAA As String = "取得関係"
Public Const PDF_EXE As String = "雇用保険役所用紙.exe"        '20110408 kon
'20110408 kon
Public pFg      As Boolean
'20110512 kon
Public hFg      As Boolean
Public jFg      As Boolean


Public cFg       As Boolean
Public cDat(3)         As String

Private Type STARTUPINFO
    cb As Long
    lpReserved As String
    lpDesktop As String
    lpTitle As String
    dwX As Long
    dwY As Long
    dwXSize As Long
    dwYSize As Long
    dwXCountChars As Long
    dwYCountChars As Long
    dwFillAttribute As Long
    dwFlags As Long
    wShowWindow As Integer
    cbReserved2 As Integer
    lpReserved2 As Long
    hStdInput As Long
    hStdOutput As Long
    hStdError As Long
End Type

Private Type PROCESS_INFORMATION
   hProcess As Long
   hThread As Long
   dwProcessID As Long
   dwThreadID As Long
End Type

Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
   hHandle As Long, ByVal dwMilliseconds 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 CloseHandle Lib "kernel32" (ByVal _
   hObject As Long) As Long

Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
'---
Private 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
'20110927 余白設定
Public Tmargin As Double
Public Lmargin As Double
Public hName As String
Public huki As Integer


'関数
Sub OpenFile(fName As String)
'関連付いたアプリケーションで立ち上げる
Call ShellExecute(0, "open", ThisWorkbook.Path & "\" & fName, vbNullString, vbNullString, 1)
End Sub

Sub OpenManual()
Application.Run "DaAddin.xla!OpenManual"
End Sub

Sub A保存()
    Worksheets("DATA").Range("A1,A3:B74,G20:I26").ClearContents
    
    Sheets("雇用保険取得届").Select
    Cells(26, 21).Value = ""
    Range("U11,D21,K21,U21,Y21,AD21").ClearContents
    Range("A1").ClearContents '現在データをクリア
    Cells(1, 1).Select
    ActiveWindow.DisplayHeadings = False
    ActiveWindow.DisplayWorkbookTabs = False
    Application.EnableEvents = False
    ThisWorkbook.Save
    Application.EnableEvents = True
End Sub
Sub 印刷()
If MsgBox("プリンタの準備はいいですか?", 1 + 32, "印刷") <> 1 Then Exit Sub
DoEvents
ActiveSheet.PrintOut
DoEvents
End Sub
Sub 戻る()
'ThisWorkbook.Close False
'20100903 kon
    ThisWorkbook.Activate
    Application.Run "DaAddin.xla!閉じる"

End Sub
Sub 選択へ()
選択.Show
End Sub
Sub 初期処理()
Sheets("雇用保険取得届").Select
選択へ
End Sub
Sub 雇用保険取得届()
Sheets("雇用保険取得届").Select
End Sub

Sub Da保存へ()

    Dim MyName As String
    If ActiveSheet.Name = "雇用保険取得届" Then
        MyName = Cells(13, 4).Value & " 作成日" & Format(Date, "geemmdd")
    ElseIf ActiveSheet.Name = "労働条件通知" Then
        MyName = Cells(7, 3).Value & " 作成日" & Format(Date, "geemmdd")
    End If
    Open Workbooks("DaMenu.xls").Path & "\HozonName.dat" For Output As #1
        Write #1, MyName
    Close #1
    
    Application.Run "DaAddin.xla!Da保存へ"
End Sub
Sub 保存読込へ()
Application.Run "DaAddin.xla!Da保存読込へ"
End Sub
Sub 設定保存()
    If MsgBox("この設定を保存しますか?", 1 + 32, "保存") <> 1 Then Exit Sub
    ActiveWindow.ScrollColumn = 1
    ActiveWindow.ScrollRow = 1
    Application.EnableEvents = False
    ThisWorkbook.Save
    Application.EnableEvents = True

End Sub
Sub 定型印の読込()
    Application.ScreenUpdating = False
    With Workbooks("DaMenu.xls").Worksheets("標準報酬月額")
    If IsError(.Cells(164, 14).Value) Then
    MsgBox "事務所データの電話番号が正しく入力されていませんので、作成することができません。(半角で0999-99-9999形式)", 16, AAA
    Exit Sub
    End If
    .Range("K162:N164").CopyPicture Appearance:=xlScreen, Format:=xlPicture
    End With
    Cells(74, 10).Select
    ActiveSheet.Paste
'20070209 kon
'    Selection.Locked = False
    Application.ScreenUpdating = True
    MsgBox "ドラッグして所定の位置に貼り付けてください。" & vbCr & _
    "この定型印を貼り付けた状態でこのシートを保存するには「原本保存」をおこなってください。", 64, AAA
'20070209 kon
    ActiveSheet.Unprotect
End Sub
Sub 労働条件通知()
Sheets("労働条件通知").Select
End Sub

Sub 会社Fへ()
Application.Run "DaAddin.xla!会社Fへ"
End Sub
Sub 給与Fへ()
Application.Run "DaAddin.xla!給与Fへ"
End Sub
Sub 個人Fへ()
Application.Run "DaAddin.xla!個人Fへ"
End Sub
Sub 保護解除()
ActiveSheet.Unprotect
ActiveWindow.DisplayHeadings = True
MsgBox "解除しました。", 64, AAA
End Sub
Sub 印刷2へ()
Dim Yousi As String
Dim Button As String


'20100830 kon
'If Cells(35, 30).Value = 1 Then Yousi = "雇用保険資格取得届印刷H2202.xls"
'If Cells(35, 30).Value = 2 Then Yousi = "雇用保険資格取得届印刷.xls"


If Cells(35, 30).Value = 1 Then Yousi = "雇用保険資格取得届印刷H2206.xls"
If Cells(35, 30).Value = 2 Then
Yousi = "雇用保険資格取得届印刷H2202.xls"
Button = "Zu9"
End If
'B5用紙廃止 20110408 kon
'If Cells(35, 30).Value = 3 Then
'Yousi = "雇用保険資格取得届印刷.xls"
'Button = "Zu8"
'End If
    '20110408 kon
'    Dim fnam As String
    If Cells(35, 30).Value = 3 Then
'20130305 kon 2013
'        frmPrint.Show
        frmPrint.Show 0
        
''' YBNO21974 この部分をCreatePDFにする
'        If cFg = True Then
''            MsgBox "印刷はキャンセルされました。", vbInformation, "資格取得届印刷"
'            Exit Sub
'        End If
'
'        If Len(Cells(13, 30).Value) > 20 Then
'            MsgBox "被保険者氏名カナが表示範囲を超えています。20文字まで表示します。(半角カナ20文字まで)", vbInformation, "資格取得届印刷"
''            Exit Sub
'        End If
'        If Len(Cells(14, 31).Value) > 20 Then
'            MsgBox "変更後の氏名カナが表示範囲を超えています。20文字まで表示します。(半角カナ20文字まで)", vbInformation, "資格取得届印刷"
''            Exit Sub
'        End If
'
'
'        fnam = ThisWorkbook.Path & "\pdf\雇用資格取得\" & Trim(Cells(13, 4).Value) & Format(Now(), "YYYYMMDDHHSS") & ".TDF"
'        If Dir(ThisWorkbook.Path & "\pdf", vbDirectory) = "" Then
'            MkDir (ThisWorkbook.Path & "\pdf")
'        End If
'        If Dir(ThisWorkbook.Path & "\pdf\雇用資格取得", vbDirectory) = "" Then
'            MkDir (ThisWorkbook.Path & "\pdf\雇用資格取得")
'        End If
'        '20110511 kon
'
'        'pdfファイルを削除する
''        On Error Resume Next
''            Kill ThisWorkbook.Path & "\pdf\雇用資格取得\" & "*.pdf"
''        On Error GoTo 0
'
'
'        Call pdf作成(fnam, pFg)
'        Dim ShellString As String
'        Dim param As String
'        param = 1
'
'
'        ShellString = """" & PathCombine(ThisWorkbook.Path, "雇用保険役所用紙.exe") & """ """ & PathCombine(GetProgramFolder, "雇用資格取得") & """ """ & fnam & """ """ & param & """ """ & pFg & """ """ & Tmargin & """ """ & Lmargin & """"
'
'        ExecCmd ShellString
'
'
'        Application.ScreenUpdating = True
'        Exit Sub
''' END YBNO 21794
    Else

    
    Dim wb As Workbook
    For Each wb In Workbooks
        If wb.Name = Yousi Then
            wb.Activate
            Exit Sub
        End If
    Next
       
    Workbooks.Open Filename:=ThisWorkbook.Path & "\" & Yousi
     
    '20101028masa 2010問題 閉じるボタンを張り付ける
    Application.ScreenUpdating = False
    If Workbooks(Yousi).BuiltinDocumentProperties("Keywords").Value <> 2010 Then
        Workbooks.Open Workbooks("DaMenu.xls").Path & "\閉じるボタン.xls"
        Workbooks("閉じるボタン.xls").Worksheets("Button").Shapes(Button).Copy
        Workbooks(Yousi).Activate
        Range("A1").Select
        ActiveSheet.Paste
        ActiveSheet.Shapes(Button).Top = 17
        ActiveSheet.Shapes(Button).Left = 17
        Range("A1").Select
        Workbooks(Yousi).BuiltinDocumentProperties("Keywords").Value = 2010
        Application.EnableEvents = False
        ActiveWorkbook.Save
        Application.EnableEvents = True
        Workbooks("閉じるボタン.xls").Close False
    End If
    Application.ScreenUpdating = True
    End If
End Sub
Public Sub CreatePDF()

    Dim fnam As String
        
    If cFg = True Then
        MsgBox "印刷はキャンセルされました。", vbInformation, "資格取得届印刷"
        Exit Sub
    End If
        
    If Len(Cells(13, 30).Value) > 20 Then
        MsgBox "被保険者氏名カナが表示範囲を超えています。20文字まで表示します。(半角カナ20文字まで)", vbInformation, "資格取得届印刷"
        Exit Sub
    End If
    If Len(Cells(14, 31).Value) > 20 Then
        MsgBox "変更後の氏名カナが表示範囲を超えています。20文字まで表示します。(半角カナ20文字まで)", vbInformation, "資格取得届印刷"
        Exit Sub
    End If
               
    fnam = ThisWorkbook.Path & "\pdf\雇用資格取得\" & Trim(Cells(13, 4).Value) & Format(Now(), "YYYYMMDDHHSS") & ".TDF"
    If Dir(ThisWorkbook.Path & "\pdf", vbDirectory) = "" Then
        MkDir (ThisWorkbook.Path & "\pdf")
    End If
    If Dir(ThisWorkbook.Path & "\pdf\雇用資格取得", vbDirectory) = "" Then
        MkDir (ThisWorkbook.Path & "\pdf\雇用資格取得")
    End If
'20110511         kon
         
    'pdfファイルを削除する
    On Error Resume Next
        Kill ThisWorkbook.Path & "\pdf\雇用資格取得\" & "*.pdf"
    On Error GoTo 0
        
    Call pdf作成(fnam, pFg)
    
    Dim ShellString As String
    Dim param As String
    param = 1
            
    ShellString = """" & PathCombine(ThisWorkbook.Path, "雇用保険役所用紙.exe") & """ """ & PathCombine(GetProgramFolder, "雇用資格取得") & """ """ & fnam & """ """ & param & """ """ & pFg & """ """ & Tmargin & """ """ & Lmargin & """"
    
    ExecCmd ShellString
            
    Application.ScreenUpdating = True

End Sub
Sub eGovへ()
    'eGov.Show
    Application.Run "EAppCom.xla!eGovFormShow", 2, "雇用取得.xls", "雇取得XMLデータ作成.xls", ThisWorkbook.Worksheets("DATA").Cells(1, 1).Value
End Sub

'20110408 kon
Private Sub pdf作成(ByVal fn As String, PrintMode As Boolean)
    
    '必要データ作成
    Dim TextFilename As String
    TextFilename = fn
    
    Dim SheetName As String
    
    SheetName = "雇用保険取得届"
    
    With Worksheets(SheetName)
        Open TextFilename For Output As #1

            Dim strData As String
            Dim iCounter As Integer
            Dim jCounter As Integer
            
            'パスワードは利用しないので空欄
            Print #1, ""
            
            '被保険者番号 4
            For jCounter = 4 To 7
                If jCounter = 4 Then
                    strData = Worksheets("雇用保険取得届").Cells(11, jCounter).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(11, jCounter).Text
                End If
            Next jCounter
            Print #1, strData


            
            '被保険者番号 6
            
            For jCounter = 9 To 14
                If jCounter = 9 Then
                    strData = Worksheets("雇用保険取得届").Cells(11, jCounter).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(11, jCounter).Text
                End If
            Next jCounter
            Print #1, strData
            
            
            '被保険者番号 1
            Print #1, Worksheets("雇用保険取得届").Cells(11, 16).Text
            
            Print #1, Worksheets("雇用保険取得届").Cells(11, 21).Text '取得区分
            Print #1, Worksheets("雇用保険取得届").Cells(13, 4).Text '被保険者氏名
            
            'フリガナ
            For jCounter = 11 To 30
                If jCounter = 11 Then
                    strData = Worksheets("雇用保険取得届").Cells(13, jCounter).Text
                ElseIf jCounter >= 27 Then
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(14, jCounter - 4).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(13, jCounter).Text
                End If
            Next jCounter
            Print #1, strData
                        
            Print #1, Worksheets("雇用保険取得届").Cells(15, 4).Text '変更後の氏名
            
            'フリガナ
            For jCounter = 11 To 30
                If jCounter = 11 Then
                    strData = Worksheets("雇用保険取得届").Cells(15, jCounter).Text
                ElseIf jCounter >= 27 Then
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(16, jCounter - 4).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(15, jCounter).Text
                End If
            Next jCounter
            Print #1, strData
            
            Print #1, Worksheets("雇用保険取得届").Cells(17, 4).Text '性別
            Print #1, Worksheets("雇用保険取得届").Cells(17, 11).Text '生年月日 年号
            '生年月日
            For jCounter = 13 To 18
                If jCounter = 13 Then
                    strData = Worksheets("雇用保険取得届").Cells(17, jCounter).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(17, jCounter).Text
                End If
            Next jCounter
            Print #1, strData
            
            '事業所番号 4
            For jCounter = 4 To 7
                If jCounter = 4 Then
                    strData = Worksheets("雇用保険取得届").Cells(19, jCounter).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(19, jCounter).Text
                End If
            Next jCounter
            Print #1, strData
            
            '事業所番号 6
            For jCounter = 9 To 14
                If jCounter = 9 Then
                    strData = Worksheets("雇用保険取得届").Cells(19, jCounter).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(19, jCounter).Text
                End If
            Next jCounter
            Print #1, strData
            '事業所番号 1
            Print #1, Worksheets("雇用保険取得届").Cells(19, 16).Text
            '取得年月日
            For jCounter = 21 To 26
                If jCounter = 21 Then
                    strData = Worksheets("雇用保険取得届").Cells(19, jCounter).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(19, jCounter).Text
                
                End If
            Next jCounter
            Print #1, strData
            Print #1, Worksheets("雇用保険取得届").Cells(21, 4).Text '原因
            
            Print #1, Worksheets("雇用保険取得届").Cells(21, 11).Text '支払態様
            
            '賃金額
            For jCounter = 13 To 16
                If jCounter = 13 Then
                    strData = Worksheets("雇用保険取得届").Cells(21, jCounter).Text
                Else
                    strData = strData & vbTab & Worksheets("雇用保険取得届").Cells(21, jCounter).Text
                End If
            Next jCounter
            Print #1, strData
            
            Print #1, Worksheets("雇用保険取得届").Cells(21, 21).Text '雇用形態
            Print #1, Worksheets("雇用保険取得届").Cells(21, 25).Text '職種
            Print #1, Worksheets("雇用保険取得届").Cells(23, 18).Text '賃金の定め
            '契約期間開始 年
            Print #1, Worksheets("雇用保険取得届").Cells(28, 30).Text
            '契約期間開始 月
            Print #1, Worksheets("雇用保険取得届").Cells(28, 31).Text
            '契約期間開始 日
            Print #1, Worksheets("雇用保険取得届").Cells(28, 32).Text
            '契約期間終了 年
            Print #1, Worksheets("雇用保険取得届").Cells(29, 30).Text
            '契約期間終了 月
            Print #1, Worksheets("雇用保険取得届").Cells(29, 31).Text
            '契約期間終了 日
            Print #1, Worksheets("雇用保険取得届").Cells(29, 32).Text

            Print #1, Worksheets("雇用保険取得届").Cells(30, 30).Text '契約更新条項の有無
            
            
            '週所定労働時間
            Print #1, Worksheets("雇用保険取得届").Cells(23, 8).Text
            Print #1, Worksheets("雇用保険取得届").Cells(23, 10).Text
            Print #1, Worksheets("雇用保険取得届").Cells(25, 7).Text '事業所名
            Print #1, Worksheets("雇用保険取得届").Cells(28, 22).Text '国籍
            Print #1, Worksheets("雇用保険取得届").Cells(29, 22).Text '在留資格
            '在留期間 年
            Print #1, Worksheets("雇用保険取得届").Cells(30, 22).Text
            '在留期間 月
            Print #1, Worksheets("雇用保険取得届").Cells(30, 25).Text
            '在留期間 日
            Print #1, Worksheets("雇用保険取得届").Cells(30, 27).Text
            
            Print #1, Worksheets("雇用保険取得届").Cells(31, 24).Text '資格外活動許可の有無
            
            Print #1, Worksheets("雇用保険取得届").Cells(32, 27).Text '派遣請負労働者として主として17以外の・・
            Print #1, Worksheets("雇用保険取得届").Cells(33, 19).Text '備考
            '提出年
            Print #1, cDat(0)
            '提出 月
…