public override void InitModuleObjectRanges(InteropExcel.Workbook ActiveWorkbook, bool AddToWorkbook = false) { string formula = string.Empty; rngp_Uploader = new ObjectRange(); rngp_Uploader.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngUploader", "=_parameter!$A$1", AddToWorkbook); rngp_LastUpload = new ObjectRange(); rngp_LastUpload.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngLastUpload", "=_parameter!$A$2", AddToWorkbook); rngp_LastDownload = new ObjectRange(); rngp_LastDownload.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngLastDownload", "=_parameter!$A$3", AddToWorkbook); rngp_NameList = new ObjectRange(); formula = @"=INDIRECT(""refNameList!$A$1:$F""&MAX(1;COUNTA(refNameList!$A$1:$A$5000)))"; rngp_NameList.InitRange(ActiveWorkbook, "refNameList", "TeamFile_rngNameList", formula, AddToWorkbook); rngNames = new ObjectRange(); formula = @"=INDIRECT(""refNameList!$A$1:$A""&MAX(1;COUNTA(refNameList!$A$1:$A$5000)))"; rngNames.InitRange(ActiveWorkbook, "refNameList", "NameList", formula, AddToWorkbook); rngcl_CurrentTeamLS = new ObjectRange(); formula = @"=INDIRECT(""Team!$G$13:$G190"")"; rngcl_CurrentTeamLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngCurrentTeamLS", formula, AddToWorkbook); rngcl_CurrentTeamWOLS = new ObjectRange(); formula = @"=INDIRECT(""Team!$H$13:$H190"")"; rngcl_CurrentTeamWOLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngCurrentTeamWOLS", formula, AddToWorkbook); rngcl_AdditionalAllocationLS = new ObjectRange(); formula = @"=INDIRECT(""Team!$I$13:$I190"")"; rngcl_AdditionalAllocationLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngAdditionalAllocationLS", formula, AddToWorkbook); rngcl_AdditionalAllocationWOLS = new ObjectRange(); formula = @"=INDIRECT(""Team!$J$13:$J190"")"; rngcl_AdditionalAllocationWOLS.InitRange(ActiveWorkbook, "Team", "TeamFile_rngAdditionalAllocationWOLS", formula, AddToWorkbook); rngcl_BridgeCurrentTeam= new ObjectRange(); formula = @"=INDIRECT(""Team!$E$13:$E190"")"; rngcl_BridgeCurrentTeam.InitRange(ActiveWorkbook, "Team", "TeamFile_rngBridgeCurrentTeam", formula, AddToWorkbook); rngcl_PlanningArea = new ObjectRange(); formula = @"=INDIRECT(""Team!$A$13:$T190"")"; rngcl_PlanningArea.InitRange(ActiveWorkbook, "Team", "TeamFile_rngPlanningArea", formula, AddToWorkbook); rngcl_NameFixed = new ObjectRange(); formula = @"=INDIRECT(""Team!$B$13:$B190"")"; rngcl_NameFixed.InitRange(ActiveWorkbook, "Team", "TeamFile_rngNameFixed", formula, AddToWorkbook); rngcl_PlanningAreaFixed = new ObjectRange(); formula = @"=INDIRECT(""Team!$A$13:$W190"")"; rngcl_PlanningAreaFixed.InitRange(ActiveWorkbook, "Team", "TeamFile_rngPlanningAreaFixed", formula, AddToWorkbook); rngcl_Comment = new ObjectRange(); formula = @"=INDIRECT(""Team!$T$13:$T190"")"; rngcl_Comment.InitRange(ActiveWorkbook, "Team", "TeamFile_rngComment", formula, AddToWorkbook); rngcl_DateFrom = new ObjectRange(); formula = @"=INDIRECT(""Team!$K$13:$K190"")"; rngcl_DateFrom.InitRange(ActiveWorkbook, "Team", "TeamFile_rngDateFrom", formula, AddToWorkbook); rngcl_DateTo = new ObjectRange(); formula = @"=INDIRECT(""Team!$L$13:$L190"")"; rngcl_DateTo.InitRange(ActiveWorkbook, "Team", "TeamFile_rngDateTo", formula, AddToWorkbook); rngcl_Name = new ObjectRange(); formula = @"=INDIRECT(""Team!$B$13:$B190"")"; rngcl_Name.InitRange(ActiveWorkbook, "Team", "TeamFile_rngName", formula, AddToWorkbook); rngcl_Status = new ObjectRange(); formula = @"=INDIRECT(""Team!$W$13:$W190"")"; rngcl_Status.InitRange(ActiveWorkbook, "Team", "TeamFile_rngStatus", formula, AddToWorkbook); rngcl_MessageHeader = new ObjectRange(); rngcl_MessageHeader.InitRange(ActiveWorkbook, "Team", "TeamFile_rngMessageHeader", "=Team!$A$11", AddToWorkbook); rngcl_Message = new ObjectRange(); rngcl_Message.InitRange(ActiveWorkbook, "Team", "TeamFile_rngMessage", "=Team!$C$11", AddToWorkbook); rngp_ManagerList = new ObjectRange(); formula = @"=INDIRECT(""_parameter!$F$1:$F""&MAX(1;COUNTA(_parameter!$F$1:$G$100)))"; rngp_ManagerList.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngManagerList", formula, AddToWorkbook); rngp_TemplateUpdate = new ObjectRange(); formula = @"=INDIRECT(""_parameter!$U$1:$U""&MAX(1;COUNTA(_parameter!$U$1:$U$100)))"; rngp_TemplateUpdate.InitRange(ActiveWorkbook, "_parameter", "TeamFile_rngTemlateUpdate", formula, AddToWorkbook); rngp_Target = new ObjectRange(); formula = @"=INDIRECT(""refTarget!$A$1:$B""&MAX(1;COUNTA(refTarget!$B$1:$B$500)))"; rngp_Target.InitRange(ActiveWorkbook, "refTarget", "TeamFile_rngTarget", formula, AddToWorkbook); //TeamFileModuleTemplateUpdates updates = new TeamFileModuleTemplateUpdates(); //TemplateUpdater.RunUpdates(updates, rngp_TemplateUpdate.GetRange()); _SqlSatementModule.InitModuleObjectRanges(ActiveWorkbook, AddToWorkbook); var wsTeam = ActiveWorkbook.TryGetSheet("Team"); if (wsTeam != null) { wsTeam.EnableOutlining = true; wsTeam.Protect("materia", AllowFiltering: true, UserInterfaceOnly: true); } }