2011/06/13

access2010 データマクロで祝日を列挙

VBAで扱えばよいのだけど、Webデータベースでも使えるようにしてみたいなと。公開されているVBAコードをデータマクロに移植した。
使い方などまだ考えていないからとりあえず該当月の祝日を出力してもらう。
Office365上で実行すると1秒弱かかっているから、WebフォームのUIマクロかWebマクロで実行できるかどうかも検討してみよう。
以降、ざっくり検証しかしていないデータマクロのメモ(xml)


<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<DataMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application">
  <DataMacro Name="GetHolidayJp">
    <Parameters>
      <Parameter Name="paramDate" Description="GetHolidayJp" />
    </Parameters>
    <Statements>
      <StatementGroup Collapsed="true" Description="Initialize">
        <Statements>
          <Action Collapsed="true" Name="SetLocalVar">
            <Argument Name="Name">lclHoliday</Argument>
            <Argument Name="Value">""</Argument>
          </Action>
          <Action Collapsed="true" Name="SetLocalVar">
            <Argument Name="Name">lclYear</Argument>
            <Argument Name="Value">Year([paramDate])</Argument>
          </Action>
          <Action Collapsed="true" Name="SetLocalVar">
            <Argument Name="Name">lclMonth</Argument>
            <Argument Name="Value">Month([paramDate])</Argument>
          </Action>
          <ConditionalBlock>
            <If Collapsed="true">
              <Condition>[lclYear]&lt;1948 Or [lclMonth]=6 Or [lclMonth]=8</Condition>
              <Statements>
                <Action Collapsed="true" Name="SetReturnVar">
                  <Argument Name="Name">GetHolidayJp</Argument>
                  <Argument Name="Value">""</Argument>
                </Action>
                <Action Name="StopMacro" />
              </Statements>
            </If>
          </ConditionalBlock>
        </Statements>
      </StatementGroup>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=1</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="元旦">
              <Statements>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclDate</Argument>
                  <Argument Name="Value">DateSerial([lclYear],1,1)</Argument>
                </Action>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclHoliday</Argument>
                  <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                </Action>
              </Statements>
            </StatementGroup>
            <StatementGroup Collapsed="true" Description="成人の日">
              <Statements>
                <ConditionalBlock>
                  <If Collapsed="true">
                    <Condition>[lclYear]&lt;=1999</Condition>
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],1,15)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(IIf(Weekday([lclDate])=1,[ldlDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </If>
                  <Else Collapsed="true">
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],1,1)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclWD</Argument>
                        <Argument Name="Value">Weekday([lclDate])</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">[lclHoliday] &amp; FormatDateTime([lcldate]+9+IIf([lclWD]&gt;2,1,0)*7-[lclWD],2)</Argument>
                      </Action>
                    </Statements>
                  </Else>
                </ConditionalBlock>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=2</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="建国記念の日">
              <Statements>
                <ConditionalBlock>
                  <If Collapsed="true">
                    <Condition>[lclYear]&gt;=1967</Condition>
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],2,11)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </If>
                </ConditionalBlock>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=3</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="春分の日">
              <Statements>
                <ConditionalBlock>
                  <If>
                    <Condition>[lclYear]&lt;=2150</Condition>
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclYearS</Argument>
                        <Argument Name="Value">[lclYear]-1980</Argument>
                      </Action>
                      <ConditionalBlock>
                        <If>
                          <Condition>[lclYear]&lt;=1979</Condition>
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclDay</Argument>
                              <Argument Name="Value">Int(20.8357+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                            </Action>
                          </Statements>
                        </If>
                        <ElseIf>
                          <Condition>[lclYear]&lt;=2099</Condition>
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclDay</Argument>
                              <Argument Name="Value">Int(20.8431+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                            </Action>
                          </Statements>
                        </ElseIf>
                        <Else Collapsed="true">
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclDay</Argument>
                              <Argument Name="Value">Int(20.851+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                            </Action>
                          </Statements>
                        </Else>
                      </ConditionalBlock>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],3,[lclDay])</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </If>
                </ConditionalBlock>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=4</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="昭和の日">
              <Statements>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclDate</Argument>
                  <Argument Name="Value">DateSerial([lclYear],4,29)</Argument>
                </Action>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclHoliday</Argument>
                  <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                </Action>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=5</Condition>
          <Statements>
            <ConditionalBlock>
              <If>
                <Condition>[lclYear]&gt;=2007</Condition>
                <Statements>
                  <StatementGroup Collapsed="true" Description="2007以降">
                    <Statements>
                      <ConditionalBlock>
                        <If>
                          <Condition>Weekday(DateSerial([lclYear],5,3))=1</Condition>
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">FormatDateTime(DateSerial([lclYear],5,4),2)</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(DateSerial([lclYear],5,5),2)</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(DateSerial([lclYear],5,6),2)</Argument>
                            </Action>
                          </Statements>
                        </If>
                        <ElseIf>
                          <Condition>Weekday(DateSerial([lclYear],5,4))=1</Condition>
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">FormatDateTime(DateSerial([lclYear],5,3),2)</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(DateSerial([lclYear],5,5),2)</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(DateSerial([lclYear],5,6),2)</Argument>
                            </Action>
                          </Statements>
                        </ElseIf>
                        <Else>
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">FormatDateTime(DateSerial([lclYear],5,3),2)</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(DateSerial([lclYear],5,4),2)</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclDate</Argument>
                              <Argument Name="Value">DateSerial([lclYear],5,5)</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                            </Action>
                          </Statements>
                        </Else>
                      </ConditionalBlock>
                    </Statements>
                  </StatementGroup>
                </Statements>
              </If>
              <ElseIf>
                <Condition>[lclYear]&gt;=1986</Condition>
                <Statements>
                  <StatementGroup Collapsed="true" Description="1986から2006">
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate3</Argument>
                        <Argument Name="Value">DateSerial([lclYear],5,3)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate4</Argument>
                        <Argument Name="Value">DateSerial([lclYear],5,4)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate5</Argument>
                        <Argument Name="Value">DateSerial([lclYear],5,5)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">WD3</Argument>
                        <Argument Name="Value">Weekday(DateSerial([lclYear],5,3))</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime(IIf([WD3]=1,[lclDate4],[lclDate3]),2)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">[lclHoliday] &amp; IIf([WD3]&gt;1 And [WD3]&lt;7,FormatDateTime([lclDate4]),"")</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(IIf(Weekday([lclDate5])=1,[lclDate5]+1,[lclDate5]),2)</Argument>
                      </Action>
                    </Statements>
                  </StatementGroup>
                </Statements>
              </ElseIf>
              <Else>
                <Statements>
                  <StatementGroup Collapsed="true" Description="1985以前">
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],5,3)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],5,5)</Argument>
                      </Action>
                      <Action Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </StatementGroup>
                </Statements>
              </Else>
            </ConditionalBlock>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=7</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="海の日">
              <Statements>
                <ConditionalBlock>
                  <If Collapsed="true">
                    <Condition>[lclYear]&gt;=2003</Condition>
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],7,1)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclWD</Argument>
                        <Argument Name="Value">Weekday([lclDate])</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime([lcldate]+16+IIf([lclWD]&gt;2,1,0)*7-[lclWD],2)</Argument>
                      </Action>
                    </Statements>
                  </If>
                  <ElseIf Collapsed="true">
                    <Condition>[lclYear]&gt;=1996</Condition>
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],7,20)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </ElseIf>
                </ConditionalBlock>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=9</Condition>
          <Statements>
            <ConditionalBlock>
              <If>
                <Condition>[lclYear]&gt;=2003</Condition>
                <Statements>
                  <StatementGroup Collapsed="true" Description="敬老の日">
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],9,1)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclWD</Argument>
                        <Argument Name="Value">Weekday([lclDate])</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDateK</Argument>
                        <Argument Name="Value">[lcldate]+16+IIf([lclWD]&gt;2,1,0)*7-[lclWD]</Argument>
                      </Action>
                    </Statements>
                  </StatementGroup>
                  <StatementGroup Collapsed="true" Description="秋分の日">
                    <Statements>
                      <ConditionalBlock>
                        <If>
                          <Condition>[lclYear]&lt;=2150</Condition>
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclYearS</Argument>
                              <Argument Name="Value">[lclYear]-1980</Argument>
                            </Action>
                            <ConditionalBlock>
                              <If>
                                <Condition>[lclYear]&lt;=1979</Condition>
                                <Statements>
                                  <Action Collapsed="true" Name="SetLocalVar">
                                    <Argument Name="Name">lclDay</Argument>
                                    <Argument Name="Value">Int(23.2588+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                                  </Action>
                                </Statements>
                              </If>
                              <ElseIf>
                                <Condition>[lclYear]&lt;=2099</Condition>
                                <Statements>
                                  <Action Collapsed="true" Name="SetLocalVar">
                                    <Argument Name="Name">lclDay</Argument>
                                    <Argument Name="Value">Int(23.2488+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                                  </Action>
                                </Statements>
                              </ElseIf>
                              <Else Collapsed="true">
                                <Statements>
                                  <Action Collapsed="true" Name="SetLocalVar">
                                    <Argument Name="Name">lclDay</Argument>
                                    <Argument Name="Value">Int(24.2488+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                                  </Action>
                                </Statements>
                              </Else>
                            </ConditionalBlock>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclDateS</Argument>
                              <Argument Name="Value">DateSerial([lclYear],9,[lclDay])</Argument>
                            </Action>
                          </Statements>
                        </If>
                      </ConditionalBlock>
                    </Statements>
                  </StatementGroup>
                  <Action Collapsed="true" Name="SetLocalVar">
                    <Argument Name="Name">lclHoliday</Argument>
                    <Argument Name="Value">FormatDateTime([lclDateK],2) &amp; IIf([lclDateS]-[lclDateK]=2,FormatDateTime([lclDateK]+1,2),"") &amp; FormatDateTime([lclDateS],2)</Argument>
                  </Action>
                </Statements>
              </If>
              <Else Collapsed="true">
                <Statements>
                  <StatementGroup Collapsed="true" Description="敬老の日">
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],9,15)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </StatementGroup>
                  <StatementGroup Collapsed="true" Description="秋分の日">
                    <Statements>
                      <ConditionalBlock>
                        <If Collapsed="true">
                          <Condition>[lclYear]&lt;=2150</Condition>
                          <Statements>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclYearS</Argument>
                              <Argument Name="Value">[lclYear]-1980</Argument>
                            </Action>
                            <ConditionalBlock>
                              <If Collapsed="true">
                                <Condition>[lclYearS]&lt;=1979</Condition>
                                <Statements>
                                  <Action Collapsed="true" Name="SetLocalVar">
                                    <Argument Name="Name">lclDay</Argument>
                                    <Argument Name="Value">Int(23.2588+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                                  </Action>
                                </Statements>
                              </If>
                              <ElseIf Collapsed="true">
                                <Condition>[lclYearS]&lt;=2099</Condition>
                                <Statements>
                                  <Action Collapsed="true" Name="SetLocalVar">
                                    <Argument Name="Name">lclDay</Argument>
                                    <Argument Name="Value">Int(23.2488+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                                  </Action>
                                </Statements>
                              </ElseIf>
                              <Else Collapsed="true">
                                <Statements>
                                  <Action Collapsed="true" Name="SetLocalVar">
                                    <Argument Name="Name">lclDay</Argument>
                                    <Argument Name="Value">Int(24.2488+(0.242194*[lclYearS])-Int([lclYearS]/4))</Argument>
                                  </Action>
                                </Statements>
                              </Else>
                            </ConditionalBlock>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclDate</Argument>
                              <Argument Name="Value">DateSerial([lclYear],3,[lclDay])</Argument>
                            </Action>
                            <Action Collapsed="true" Name="SetLocalVar">
                              <Argument Name="Name">lclHoliday</Argument>
                              <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(IIf(Weekday([lclDate])=1,[lclDate]+1,[lclDate]),2)</Argument>
                            </Action>
                          </Statements>
                        </If>
                      </ConditionalBlock>
                    </Statements>
                  </StatementGroup>
                </Statements>
              </Else>
            </ConditionalBlock>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=10</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="体育の日">
              <Statements>
                <ConditionalBlock>
                  <If Collapsed="true">
                    <Condition>[lclYear]&lt;=1999</Condition>
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],10,10)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[ldlDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </If>
                  <Else Collapsed="true">
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],10,1)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclWD</Argument>
                        <Argument Name="Value">Weekday([lclDate])</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime([lcldate]+9+IIf([lclWD]&gt;2,1,0)*7-[lclWD],2)</Argument>
                      </Action>
                    </Statements>
                  </Else>
                </ConditionalBlock>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=11</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="文化の日">
              <Statements>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclDate</Argument>
                  <Argument Name="Value">DateSerial([lclYear],11,3)</Argument>
                </Action>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclHoliday</Argument>
                  <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[ldlDate]+1,[lclDate]),2)</Argument>
                </Action>
              </Statements>
            </StatementGroup>
            <StatementGroup Collapsed="true" Description="勤労感謝の日">
              <Statements>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclDate</Argument>
                  <Argument Name="Value">DateSerial([lclYear],11,23)</Argument>
                </Action>
                <Action Collapsed="true" Name="SetLocalVar">
                  <Argument Name="Name">lclHoliday</Argument>
                  <Argument Name="Value">[lclHoliday] &amp; FormatDateTime(IIf(Weekday([lclDate])=1,[ldlDate]+1,[lclDate]),2)</Argument>
                </Action>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
      <ConditionalBlock>
        <If Collapsed="true">
          <Condition>[lclMonth]=12</Condition>
          <Statements>
            <StatementGroup Collapsed="true" Description="天皇誕生日">
              <Statements>
                <ConditionalBlock>
                  <If Collapsed="true">
                    <Condition>[lclYear]&gt;=1989</Condition>
                    <Statements>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclDate</Argument>
                        <Argument Name="Value">DateSerial([lclYear],12,23)</Argument>
                      </Action>
                      <Action Collapsed="true" Name="SetLocalVar">
                        <Argument Name="Name">lclHoliday</Argument>
                        <Argument Name="Value">FormatDateTime(IIf(Weekday([lclDate])=1,[ldlDate]+1,[lclDate]),2)</Argument>
                      </Action>
                    </Statements>
                  </If>
                </ConditionalBlock>
              </Statements>
            </StatementGroup>
            <Action Collapsed="true" Name="SetReturnVar">
              <Argument Name="Name">GetHolidayJp</Argument>
              <Argument Name="Value">[lclHoliday]</Argument>
            </Action>
            <Action Name="StopMacro" />
          </Statements>
        </If>
      </ConditionalBlock>
    </Statements>
  </DataMacro>
</DataMacros>

5月がおかしい。直してみた。
正確に言うと祝日ではなくて、日曜日を除く休日
振替休日は1973年以降のロジック忘れてた。←まだ
春分秋分のロジック←修正

0 件のコメント: