1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?> 2*b1cdbd2cSJim Jagielski<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd"> 3*b1cdbd2cSJim Jagielski<!--*********************************************************** 4*b1cdbd2cSJim Jagielski * 5*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 6*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 7*b1cdbd2cSJim Jagielski * distributed with this work for additional information 8*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 9*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 10*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 11*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 14*b1cdbd2cSJim Jagielski * 15*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 16*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 17*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 19*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 20*b1cdbd2cSJim Jagielski * under the License. 21*b1cdbd2cSJim Jagielski * 22*b1cdbd2cSJim Jagielski ***********************************************************--> 23*b1cdbd2cSJim Jagielski<script:module xmlns:script="http://openoffice.org/2000/script" script:name="CalendarMain" script:language="StarBasic">Option Explicit 24*b1cdbd2cSJim Jagielski 25*b1cdbd2cSJim JagielskiConst _DEBUG = 0 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski' CalenderMain 28*b1cdbd2cSJim JagielskiPublic sCurLangLocale as String 29*b1cdbd2cSJim JagielskiPublic sCurCountryLocale as String 30*b1cdbd2cSJim Jagielski' This flag serves as a query if the individual Data should be saved 31*b1cdbd2cSJim JagielskiPublic bCalOwnDataChanged as Boolean 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski'BankHoliday Functions 34*b1cdbd2cSJim JagielskiPublic CalBankholidayName$ (1 To 374) 35*b1cdbd2cSJim JagielskiPublic CalTypeOfBankHoliday% (1 To 374) 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim JagielskiPublic Const cHolidayType_None = 0 38*b1cdbd2cSJim JagielskiPublic Const cHolidayType_Full = 1 39*b1cdbd2cSJim JagielskiPublic Const cHolidayType_Half = 2 40*b1cdbd2cSJim JagielskiPublic Const cHolidayType_Own = 4 41*b1cdbd2cSJim Jagielski 42*b1cdbd2cSJim JagielskiPublic cCalSubcmdDeleteSelect_DeleteSelEntry$ 43*b1cdbd2cSJim JagielskiPublic cCalSubcmdDeleteSelect_DeleteSelEntryTitle$ 44*b1cdbd2cSJim JagielskiPublic cCalSubcmdSwitchOwnDataOrGeneral_Back$ 45*b1cdbd2cSJim JagielskiPublic cCalSubcmdSwitchOwnDataOrGeneral_OwnData$ 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski'Language 48*b1cdbd2cSJim JagielskiPublic cCalLongMonthNames(11) as String 49*b1cdbd2cSJim JagielskiPublic cCalShortMonthNames(11) as String 50*b1cdbd2cSJim Jagielski 51*b1cdbd2cSJim JagielskiPublic sBitmapFilename$ 52*b1cdbd2cSJim JagielskiPublic sCalendarTitle$, sMonthTitle$, sWizardTitle$, sError$ 53*b1cdbd2cSJim JagielskiPublic cCalStyleWorkday$, cCalStyleWeekend$ 54*b1cdbd2cSJim Jagielski 55*b1cdbd2cSJim JagielskiPublic CalChoosenLand as Integer 56*b1cdbd2cSJim Jagielski 57*b1cdbd2cSJim JagielskiPublic oDocument as Object 58*b1cdbd2cSJim JagielskiPublic oSheets as Object 59*b1cdbd2cSJim JagielskiPublic oSheet as Object 60*b1cdbd2cSJim JagielskiPublic oStatusLine as Object 61*b1cdbd2cSJim JagielskiPublic bCancelTask as Boolean 62*b1cdbd2cSJim JagielskiPublic oNumberFormatter as Object 63*b1cdbd2cSJim Jagielski 64*b1cdbd2cSJim Jagielski' BL* means "BundesLand" (for german states only) 65*b1cdbd2cSJim JagielskiPublic CONST CalBLBayern = 1 66*b1cdbd2cSJim JagielskiPublic CONST CalBLBadenWuert = 2 67*b1cdbd2cSJim JagielskiPublic CONST CalBLBerlin = 3 68*b1cdbd2cSJim JagielskiPublic CONST CalBLBremen = 4 69*b1cdbd2cSJim JagielskiPublic CONST CalBLBrandenburg = 5 70*b1cdbd2cSJim JagielskiPublic CONST CalBLHamburg = 6 71*b1cdbd2cSJim JagielskiPublic CONST CalBLHessen = 7 72*b1cdbd2cSJim JagielskiPublic CONST CalBLMeckPomm = 8 73*b1cdbd2cSJim JagielskiPublic CONST CalBLNiedersachsen = 9 74*b1cdbd2cSJim JagielskiPublic CONST CalBLNordrheinWest = 10 75*b1cdbd2cSJim JagielskiPublic CONST CalBLRheinlandPfalz = 11 76*b1cdbd2cSJim JagielskiPublic CONST CalBLSaarland = 12 77*b1cdbd2cSJim JagielskiPublic CONST CalBLSachsen = 13 78*b1cdbd2cSJim JagielskiPublic CONST CalBLSachsenAnhalt = 14 79*b1cdbd2cSJim JagielskiPublic CONST CalBLSchlHolstein = 15 80*b1cdbd2cSJim JagielskiPublic CONST CalBLThueringen = 16 81*b1cdbd2cSJim Jagielski 82*b1cdbd2cSJim JagielskiPublic DlgCalendar as Object 83*b1cdbd2cSJim JagielskiPublic DlgCalModel as Object 84*b1cdbd2cSJim JagielskiPublic lDateFormat as Long 85*b1cdbd2cSJim JagielskiPublic lDateStandardFormat as Long 86*b1cdbd2cSJim Jagielski 87*b1cdbd2cSJim Jagielski 88*b1cdbd2cSJim Jagielski 89*b1cdbd2cSJim JagielskiSub CalAutopilotTable() 90*b1cdbd2cSJim JagielskiDim BitmapDir as String 91*b1cdbd2cSJim JagielskiDim iThisMonth as Integer 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski'On Error Goto ErrorHandler 94*b1cdbd2cSJim Jagielski BasicLibraries.LoadLibrary("Tools") 95*b1cdbd2cSJim Jagielski bSelectByMouseMove = True 96*b1cdbd2cSJim Jagielski oDocument = ThisComponent 97*b1cdbd2cSJim Jagielski oStatusline = oDocument.GetCurrentController.GetFrame.CreateStatusIndicator 98*b1cdbd2cSJim Jagielski ToggleWindow(False) 99*b1cdbd2cSJim Jagielski sCurLangLocale = oDocument.CharLocale.Language 100*b1cdbd2cSJim Jagielski sCurCountryLocale = oDocument.CharLocale.Country 101*b1cdbd2cSJim Jagielski DlgCalendar = LoadDialog("Schedule", "DlgCalendar") 102*b1cdbd2cSJim Jagielski DlgCalModel = DlgCalendar.Model 103*b1cdbd2cSJim Jagielski LoadLanguage(sCurLangLocale) 104*b1cdbd2cSJim Jagielski CalInitGlobalVariablesDate() 105*b1cdbd2cSJim Jagielski BitmapDir = GetOfficeSubPath("Template","../wizard/bitmap") 106*b1cdbd2cSJim Jagielski DlgCalModel.imgCountry.ImageURL = BitmapDir & sBitmapFilename 107*b1cdbd2cSJim Jagielski CalChoosenLand = -2 108*b1cdbd2cSJim Jagielski CalLoadOwnData() 109*b1cdbd2cSJim Jagielski 110*b1cdbd2cSJim Jagielski With DlgCalModel 111*b1cdbd2cSJim Jagielski .cmdDelete.Enabled = False 112*b1cdbd2cSJim Jagielski .lstMonth.StringItemList() = cCalShortMonthNames() 113*b1cdbd2cSJim Jagielski Select Case sCurLangLocale 114*b1cdbd2cSJim Jagielski Case cLANGUAGE_JAPANESE 115*b1cdbd2cSJim Jagielski .lstOwnData.FontName = "HG MinochoL" 116*b1cdbd2cSJim Jagielski .txtEvent.FontName = "HG MinchoL" 117*b1cdbd2cSJim Jagielski Case cLANGUAGE_CHINESE 118*b1cdbd2cSJim Jagielski If oDocument.CharLocale.Country = "CN" Then 119*b1cdbd2cSJim Jagielski .lstOwnData.FontName = "FZ Song Ti" 120*b1cdbd2cSJim Jagielski .txtEvent.FontName = "FZ Song Ti" 121*b1cdbd2cSJim Jagielski Else 122*b1cdbd2cSJim Jagielski .lstOwnData.FontName = "FZ Ming Ti" 123*b1cdbd2cSJim Jagielski .txtEvent.FontName = "FZ Ming Ti" 124*b1cdbd2cSJim Jagielski End If 125*b1cdbd2cSJim Jagielski Case "ko" 126*b1cdbd2cSJim Jagielski .lstOwnData.FontName = "Sun Gulim" 127*b1cdbd2cSJim Jagielski .txtEvent.FontName = "Sun Gulim" 128*b1cdbd2cSJim Jagielski End Select 129*b1cdbd2cSJim Jagielski .lstOwnEventMonth.StringItemList() = cCalShortMonthNames() 130*b1cdbd2cSJim Jagielski .optYear.State = 1 131*b1cdbd2cSJim Jagielski .txtYear.Value = Year(Now()) 132*b1cdbd2cSJim Jagielski .txtYear.Tag = .txtYear.Value 133*b1cdbd2cSJim Jagielski .Step = 1 134*b1cdbd2cSJim Jagielski End With 135*b1cdbd2cSJim Jagielski SetupNumberFormatter(sCurLangLocale, sCurCountryLocale) 136*b1cdbd2cSJim Jagielski CalChooseCalendar() ' month 137*b1cdbd2cSJim Jagielski iThisMonth = Month(Now) 138*b1cdbd2cSJim Jagielski DlgCalendar.GetControl("lstMonth").SelectItemPos(iThisMonth-1, True) 139*b1cdbd2cSJim Jagielski DlgCalendar.GetControl("lstHolidays").SelectItemPos(0,True) 140*b1cdbd2cSJim Jagielski DlgCalModel.cmdGoOn.DefaultButton = True 141*b1cdbd2cSJim Jagielski ToggleWindow(True) 142*b1cdbd2cSJim Jagielski DlgCalendar.GetControl("lblHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN 143*b1cdbd2cSJim Jagielski DlgCalendar.GetControl("lstHolidays").Visible = sCurLangLocale = cLANGUAGE_GERMAN 144*b1cdbd2cSJim Jagielski fHeightCorrFactor = DlgCalendar.GetControl("imgCountry").Size.Height/198 145*b1cdbd2cSJim Jagielski fWidthCorrFactor = DlgCalendar.GetControl("imgCountry").Size.Width/166 146*b1cdbd2cSJim Jagielski DlgCalendar.Execute() 147*b1cdbd2cSJim Jagielski DlgCalendar.Dispose() 148*b1cdbd2cSJim Jagielski Exit Sub 149*b1cdbd2cSJim JagielskiErrorHandler: 150*b1cdbd2cSJim Jagielski MsgBox(sError$, 16, sWizardTitle$) 151*b1cdbd2cSJim JagielskiEnd Sub 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim Jagielski 154*b1cdbd2cSJim JagielskiSub SetupNumberFormatter(sCurLangLocale as String, sCurCountryLocale as String) 155*b1cdbd2cSJim JagielskiDim oFormats as Object 156*b1cdbd2cSJim JagielskiDim DateFormatString as String 157*b1cdbd2cSJim Jagielski oFormats = oDocument.getNumberFormats() 158*b1cdbd2cSJim Jagielski Select Case sCurLangLocale 159*b1cdbd2cSJim Jagielski Case cLANGUAGE_GERMAN 160*b1cdbd2cSJim Jagielski DateFormatString = "TT.MMM" 161*b1cdbd2cSJim Jagielski Case cLANGUAGE_ENGLISH 162*b1cdbd2cSJim Jagielski DateFormatString = "MMM DD" 163*b1cdbd2cSJim Jagielski Case cLANGUAGE_FRENCH 164*b1cdbd2cSJim Jagielski DateFormatString = "JJ/MMM" 165*b1cdbd2cSJim Jagielski Case cLANGUAGE_ITALIAN 166*b1cdbd2cSJim Jagielski DateFormatString = "GG/MMM" 167*b1cdbd2cSJim Jagielski Case cLANGUAGE_SPANISH 168*b1cdbd2cSJim Jagielski DateFormatString = "DD/MMM" 169*b1cdbd2cSJim Jagielski Case cLANGUAGE_PORTUGUESE 170*b1cdbd2cSJim Jagielski If sCurCountryLocale = "BR" Then 171*b1cdbd2cSJim Jagielski DateFormatString = "DD/MMM" 172*b1cdbd2cSJim Jagielski Else 173*b1cdbd2cSJim Jagielski DateFormatString = "DD-MMM" 174*b1cdbd2cSJim Jagielski End If 175*b1cdbd2cSJim Jagielski Case cLANGUAGE_DUTCH 176*b1cdbd2cSJim Jagielski DateFormatString = "DD/MMM" 177*b1cdbd2cSJim Jagielski Case cLANGUAGE_SWEDISH 178*b1cdbd2cSJim Jagielski DateFormatString = "MMM DD" 179*b1cdbd2cSJim Jagielski Case cLANGUAGE_DANISH 180*b1cdbd2cSJim Jagielski DateFormatString = "DD-MMM" 181*b1cdbd2cSJim Jagielski Case cLANGUAGE_POLISH 182*b1cdbd2cSJim Jagielski DateFormatString = "MMM DD" 183*b1cdbd2cSJim Jagielski Case cLANGUAGE_RUSSIAN 184*b1cdbd2cSJim Jagielski DateFormatString = "MMM DD" 185*b1cdbd2cSJim Jagielski Case cLANGUAGE_JAPANESE 186*b1cdbd2cSJim Jagielski DateFormatString = "M月D日" 187*b1cdbd2cSJim Jagielski Case cLANGUAGE_CHINESE 188*b1cdbd2cSJim Jagielski If sCurCountryLocale = "TW" Then 189*b1cdbd2cSJim Jagielski DateFormatString = "MMMMD" &"""" & "日" & """" 190*b1cdbd2cSJim Jagielski Else 191*b1cdbd2cSJim Jagielski DateFormatString = "M" & """" & "月" & """" & "D" &"""" & "日" & """" 192*b1cdbd2cSJim Jagielski End If 193*b1cdbd2cSJim Jagielski Case cLANGUAGE_GREEK 194*b1cdbd2cSJim Jagielski DateFormatString = "DD/MMM" 195*b1cdbd2cSJim Jagielski Case cLANGUAGE_TURKISH 196*b1cdbd2cSJim Jagielski DateFormatString = "DD/MMM" 197*b1cdbd2cSJim Jagielski Case cLANGUAGE_POLISH 198*b1cdbd2cSJim Jagielski DateFormatString = "MMM DD" 199*b1cdbd2cSJim Jagielski Case cLANGUAGE_FINNISH 200*b1cdbd2cSJim Jagielski DateFormatString = "PP.KKK" 201*b1cdbd2cSJim Jagielski End Select 202*b1cdbd2cSJim Jagielski 203*b1cdbd2cSJim Jagielski lDateFormat = AddNumberFormat(oFormats, DateFormatString, oDocument.CharLocale) 204*b1cdbd2cSJim Jagielski lDateStandardFormat = oFormats.getStandardFormat(com.sun.star.util.NumberFormat.DATE, oDocument.CharLocale) 205*b1cdbd2cSJim Jagielski 206*b1cdbd2cSJim Jagielski' lDateStandardFormat = AddNumberFormat(oFormats, StandardDateFormatString, oDocument.CharLocale) 207*b1cdbd2cSJim Jagielski oNumberFormatter = createUNOService("com.sun.star.util.NumberFormatter") 208*b1cdbd2cSJim Jagielski oNumberFormatter.attachNumberFormatsSupplier(oDocument) 209*b1cdbd2cSJim JagielskiEnd Sub 210*b1cdbd2cSJim Jagielski 211*b1cdbd2cSJim Jagielski 212*b1cdbd2cSJim JagielskiFunction AddNumberFormat(oNumberFormats as Object, FormatString as String, oLocale as Object) as Long 213*b1cdbd2cSJim JagielskiDim lLocDateFormat as Long 214*b1cdbd2cSJim Jagielski lLocDateFormat = oNumberFormats.QueryKey(FormatString, oLocale, True) 215*b1cdbd2cSJim Jagielski If lLocDateFormat = -1 Then 216*b1cdbd2cSJim Jagielski lLocDateFormat = oNumberFormats.addNew(FormatString, oLocale) 217*b1cdbd2cSJim Jagielski End If 218*b1cdbd2cSJim Jagielski AddNumberFormat() = lLocDateFormat 219*b1cdbd2cSJim JagielskiEnd Function 220*b1cdbd2cSJim Jagielski 221*b1cdbd2cSJim Jagielski 222*b1cdbd2cSJim JagielskiSub CalChooseCalendar() 223*b1cdbd2cSJim Jagielski With DlgCalModel 224*b1cdbd2cSJim Jagielski .lstMonth.Enabled = .optMonth.State = 1 225*b1cdbd2cSJim Jagielski .lblMonth.Enabled = .optMonth.State = 1 226*b1cdbd2cSJim Jagielski End With 227*b1cdbd2cSJim JagielskiEnd Sub 228*b1cdbd2cSJim Jagielski 229*b1cdbd2cSJim Jagielski 230*b1cdbd2cSJim JagielskiSub CalcmdCancel() 231*b1cdbd2cSJim Jagielski Call CalSaveOwnData() 232*b1cdbd2cSJim Jagielski DlgCalendar.EndExecute 233*b1cdbd2cSJim JagielskiEnd Sub 234*b1cdbd2cSJim Jagielski 235*b1cdbd2cSJim Jagielski 236*b1cdbd2cSJim JagielskiSub CalcmdOk() 237*b1cdbd2cSJim Jagielski ' cmdOk is called when the Button 'Read' is clicked on 238*b1cdbd2cSJim Jagielski ' It is either given out a month or a year 239*b1cdbd2cSJim JagielskiDim i, iSelYear as Integer 240*b1cdbd2cSJim JagielskiDim SelYear as String 241*b1cdbd2cSJim Jagielski' DlgCalendar.Visible = False 242*b1cdbd2cSJim Jagielski 243*b1cdbd2cSJim Jagielski oSheets = oDocument.sheets 244*b1cdbd2cSJim Jagielski Call CalSaveOwnData() 245*b1cdbd2cSJim Jagielski UnprotectSheets(oSheets) 246*b1cdbd2cSJim Jagielski oSheets.RemovebyName(oSheets.GetbyIndex(0).Name) 247*b1cdbd2cSJim Jagielski iSelYear = DlgCalModel.txtYear.Value 248*b1cdbd2cSJim Jagielski Select Case sCurLangLocale 249*b1cdbd2cSJim Jagielski Case cLANGUAGE_GERMAN 250*b1cdbd2cSJim Jagielski If Ubound(DlgCalModel.lstHolidays.SelectedItems()) > -1 Then 251*b1cdbd2cSJim Jagielski CalChoosenLand = DlgCalModel.lstHolidays.SelectedItems(0) 252*b1cdbd2cSJim Jagielski Else 253*b1cdbd2cSJim Jagielski CalChoosenLand = 0 254*b1cdbd2cSJim Jagielski End If 255*b1cdbd2cSJim Jagielski Call CalFindWholeYearHolidays_GERMANY(iSelYear, CalChoosenLand) 256*b1cdbd2cSJim Jagielski Case cLANGUAGE_ENGLISH 257*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_US(iSelYear) 258*b1cdbd2cSJim Jagielski Case cLANGUAGE_FRENCH 259*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_FRANCE(iSelYear) 260*b1cdbd2cSJim Jagielski Case cLANGUAGE_ITALIAN 261*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_ITA(iSelYear) 262*b1cdbd2cSJim Jagielski Case cLANGUAGE_SPANISH 263*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_SPAIN(iSelYear) 264*b1cdbd2cSJim Jagielski Case cLANGUAGE_PORTUGUESE 265*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_PORT(iSelYear) 266*b1cdbd2cSJim Jagielski Case cLANGUAGE_DUTCH 267*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_NL(iSelYear) 268*b1cdbd2cSJim Jagielski Case cLANGUAGE_SWEDISH 269*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_SWED(iSelYear) 270*b1cdbd2cSJim Jagielski Case cLANGUAGE_DANISH 271*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_DK(iSelYear) 272*b1cdbd2cSJim Jagielski Case cLANGUAGE_POLISH 273*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_PL(iSelYear) 274*b1cdbd2cSJim Jagielski Case cLANGUAGE_RUSSIAN 275*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_RU(iSelYear) 276*b1cdbd2cSJim Jagielski Case cLANGUAGE_JAPANESE 277*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_JP(iSelYear) 278*b1cdbd2cSJim Jagielski Case cLANGUAGE_CHINESE 279*b1cdbd2cSJim Jagielski If sCurCountryLocale = "TW" Then 280*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_TW(iSelYear) 281*b1cdbd2cSJim Jagielski Else 282*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_CN(iSelYear) 283*b1cdbd2cSJim Jagielski End If 284*b1cdbd2cSJim Jagielski Case cLANGUAGE_GREEK 285*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_GREEK(iSelYear) 286*b1cdbd2cSJim Jagielski Case cLANGUAGE_TURKISH 287*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_TRK(iSelYear) 288*b1cdbd2cSJim Jagielski Case cLANGUAGE_POLISH 289*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_PL(iSelYear) 290*b1cdbd2cSJim Jagielski Case cLANGUAGE_FINNISH 291*b1cdbd2cSJim Jagielski Call FindWholeYearHolidays_FI(iSelYear) 292*b1cdbd2cSJim Jagielski End Select 293*b1cdbd2cSJim Jagielski 294*b1cdbd2cSJim Jagielski Call CalInsertOwnDataInTables(iSelYear) 295*b1cdbd2cSJim Jagielski 296*b1cdbd2cSJim Jagielski If DlgCalModel.optYear.State = 1 Then 297*b1cdbd2cSJim Jagielski oSheets.RemovebyName(oSheets.GetbyIndex(0).Name) 298*b1cdbd2cSJim Jagielski oSheet = oSheets.GetbyIndex(0) 299*b1cdbd2cSJim Jagielski oSheet.Name = sCalendarTitle$ + " " + iSelYear 300*b1cdbd2cSJim Jagielski oDocument.AddActionLock 301*b1cdbd2cSJim Jagielski Call CalCreateYearTable(iSelYear) 302*b1cdbd2cSJim Jagielski ElseIf DlgCalModel.optMonth.State = 1 Then 303*b1cdbd2cSJim Jagielski Dim iMonth 304*b1cdbd2cSJim Jagielski iMonth = DlgCalModel.lstMonth.SelectedItems(0) + 1 305*b1cdbd2cSJim Jagielski oSheets.RemovebyName(oSheets.GetbyIndex(1).Name) 306*b1cdbd2cSJim Jagielski oSheet = oSheets.GetbyIndex(0) 307*b1cdbd2cSJim Jagielski If sMonthTitle = "" Then 308*b1cdbd2cSJim Jagielski oSheet.Name = cCalLongMonthNames(iMonth-1) 309*b1cdbd2cSJim Jagielski Else 310*b1cdbd2cSJim Jagielski oSheet.Name = sMonthTitle + " " + cCalLongMonthNames(iMonth-1) 311*b1cdbd2cSJim Jagielski End If 312*b1cdbd2cSJim Jagielski oDocument.AddActionLock 313*b1cdbd2cSJim Jagielski Call CalCreateMonthTable(iSelYear, iMonth) 314*b1cdbd2cSJim Jagielski End If 315*b1cdbd2cSJim Jagielski 316*b1cdbd2cSJim Jagielski oDocument.RemoveActionLock 317*b1cdbd2cSJim Jagielski oSheet.protect("") 318*b1cdbd2cSJim Jagielski oStatusLine.End 319*b1cdbd2cSJim Jagielski DlgCalendar.EndExecute() 320*b1cdbd2cSJim Jagielski bCancelTask = True 321*b1cdbd2cSJim JagielskiEnd Sub 322*b1cdbd2cSJim Jagielski</script:module> 323