하고자 하는 것은 위 함수 내에서 fmInfoProgress를 보여주고 싶습니다.
fmInfoProgress는 '실행중입니다'라는 label 하나 있는데
위처럼 하면 label이 안나오는 군요..
procedure p지정휴무_계획서(tmpDate : TDate); 함수에서는 엑셀을 열었다 저장하고 닫습니다..
procedure p지정휴무_계획서(tmpDate : TDate);
begin
fmInfoProgress.Show;
const
xlCenter = -4108; //Excel 실행 -> VBA -> 개체 찾아보기
xlLeft = -4131;
xlContinuous = 1;
xlDash = -4115;
xlDashDot = 4;
xlDashDotDot = 5;
xlDot = -4118;
xlDouble = -4119;
xlLineStyleNone = -4142;
xlSlantDashDot = 13;
xlThick = 4;
FIX_EXCEL_COLUMN_NUM = 3;
var
ExcelApp, ExcelWorkSheet, ExcelWorkBook, ExcelRange: OleVariant;
iFilePath : ansiString;
tmpString, strFileName : String;
i, j, k, m, tmpValue : Integer;
nManCount, n3HCount, isInteger, n3H1, n3H2 : Integer;
tmpDay, nRowCount, nCycle, nYok, nYokCheckCount : Integer;
wdYear, wdMonth, wdDay : Word;
aPart1, aPart2, aPart3, aYoil : aTmp3H;
aYok : Array[0..100] of String;
begin
fmInfoProgress.Show; <======================================
tmpDay := Date_DaysInMonth(tmpDate);
ShortDateFormat:= 'yyyy년 mm월';
iFilePath:= ExtractFilePath(Application.ExeName);
strFileName := fGetExcelExt('지정휴무 계획표');
pGetManData;
for i := 0 to Length(aYok) - 1 do
begin
aYok[i] := '';
end;
nYok := 0;
i := 0;
while i < Length(aReadManData) - 1 do
begin
nYokCheckCount := 0;
for j := 0 to Length(aYok) - 1 do
begin
if aYok[j] = aReadManData[i] then
begin
nYokCheckCount := nYokCheckCount + 1;
end
end;
if nYokCheckCount = 0 then
begin
aYok[nYok] := aReadManData[i];
inc(nYok);
end;
i := i + 15;
end;
try
ExcelApp := CreateOLEObject('Excel.Application');
ExcelApp.Visible := False;
ExcelApp.DisplayAlerts := False; //Quit 할때 저장여부 묻는 Dialog 안띄우게 함
ExcelWorkBook := ExcelApp.WorkBooks.Add;
ExcelWorkSheet := ExcelApp.WorkBooks[1].Sheets[3].Select;
ExcelWorkSheet := ExcelApp.ActiveSheet.Delete;
ExcelWorkSheet := ExcelApp.WorkBooks[1].Sheets[2].Select;
ExcelWorkSheet := ExcelApp.ActiveSheet.Delete;
for nYokCheckCount := 0 to nYok - 2 do
begin
ExcelWorkSheet := ExcelApp.Sheets.Add(after := ExcelApp.ActiveSheet);
end;
Except
end;
for nYokCheckCount := 0 to nYok - 1 do
begin
ExcelWorkSheet := ExcelApp.WorkBooks[1].Sheets[nYokCheckCount + 1].Select;
ExcelWorkSheet := ExcelApp.ActiveSheet;
Try
ExcelApp.ActiveSheet.Name := aYok[nYokCheckCount] + '역';
nRowCount := fGetYokMan(aYok[nYokCheckCount]) + 6;
ExcelWorksheet.Columns.HorizontalAlignment := xlCenter;
tmpString := fGetExcelColumnName(tmpDay + 3) + IntToStr(nRowCount);
ExcelWorkSheet.Range['A2', tmpString].Cells.Borders.LineStyle :=xlContinuous;
ExcelWorkSheet.Cells[1, 1].Value := DateToStr(tmpDate) + ' 지정휴무 계획표';
tmpString := fGetExcelColumnName(tmpDay + 3) + '1';
ExcelRange := ExcelWorksheet.Cells[1, 1];
ExcelRange.ColumnWidth := 5;
ExcelRange.RowHeight := 48;
ExcelWorkSheet.Range['A1', tmpString].Select;
ExcelWorkSheet.Range['A1', tmpString].Font.Bold := True;
ExcelWorkSheet.Range['A1', tmpString].Font.Size := 22;
ExcelApp.Selection.Merge;
ExcelWorkSheet.Cells[2, 1].Value := aYok[nYokCheckCount] + '역';
ExcelWorkSheet.Range['A2', 'C2'].Select;
ExcelApp.Selection.Merge;
tmpString := fGetExcelColumnName(tmpDay + 3) + '2';
ExcelRange.Range['D2', tmpString].Select;
ExcelApp.Selection.Merge;
ExcelWorkSheet.Cells[3, 1].Value := '근무조';
ExcelWorkSheet.Range['A3', 'A4'].Select;
ExcelApp.Selection.Merge;
ExcelWorkSheet.Cells[3, 2].Value := '직명';
ExcelRange := ExcelWorksheet.Cells[3, 2];
ExcelRange.ColumnWidth := 5;
ExcelWorkSheet.Range['B3', 'B4'].Select;
ExcelApp.Selection.Merge;
ExcelWorkSheet.Cells[3, 3].Value := '성명';
ExcelRange := ExcelWorksheet.Cells[3, 3];
ExcelRange.ColumnWidth := 7;
ExcelWorkSheet.Range['C3', 'C4'].Select;
ExcelApp.Selection.Merge;
ExcelWorkSheet.Cells[nRowCount - 1, 1].Value := '비 고';
ExcelWorkSheet.Range['A' + IntToStr(nRowCount - 1), 'C' + IntToStr(nRowCount)].Select;
ExcelApp.Selection.Merge;
ExcelWorkSheet.Cells[(nRowCount - 1), 4].Value := '● : 쉬는 지정휴무, ■ : 근무하는 지정휴무';
ExcelWorkSheet.Range['D' + IntToStr(nRowCount - 1), fGetExcelColumnName(tmpDay + 3) + IntToStr(nRowCount - 1)].Select;
ExcelApp.Selection.Merge;
ExcelWorksheet.Range['D' + IntToStr(nRowCount - 1), fGetExcelColumnName(tmpDay + 3) + IntToStr(nRowCount - 1)].HorizontalAlignment := xlLeft;
ExcelWorkSheet.Cells[nRowCount, 4].Value := '지정휴일 - 근무일 7일 미만 : 없음, 근무일 7일 이상 21일 미만 : 1일 , 근무일 21일 이상 : 2일';
ExcelWorkSheet.Range['D' + IntToStr(nRowCount), fGetExcelColumnName(tmpDay + 3) + IntToStr(nRowCount)].Select;
ExcelApp.Selection.Merge;
ExcelWorksheet.Range['D' + IntToStr(nRowCount), fGetExcelColumnName(tmpDay + 3) + IntToStr(nRowCount)].HorizontalAlignment := xlLeft;
tmpString := fGetExcelColumnName(tmpDay + 3) + '1';
ExcelWorkSheet.Range['A1', tmpString].Select;
i := FIX_EXCEL_COLUMN_NUM + 1;
while i <= (tmpDay + FIX_EXCEL_COLUMN_NUM) do
begin
ExcelRange := ExcelWorkSheet.Cells[1, i];
ExcelRange.ColumnWidth := 2;
i := i + 1;
end;
i := 2;
while i <= nRowCount do
begin
ExcelRange := ExcelWorkSheet.Cells[i, 1];
ExcelRange.RowHeight := 20;
inc(i);
end;
j := 4;
for i := 1 to tmpDay do
begin
ExcelWorkSheet.Cells[3, j] := i;
inc(j);
end;
aYoil := fGet요일(aReadIn3H[2]);
j := 4;
for i := 0 to (tmpDay - 1) do
begin
if (aYoil[i] = '토') or (aYoil[i] = '일') then
begin
ExcelWorkSheet.Cells[4, j].Font.Color := clRed;
end;
ExcelWorkSheet.Cells[4, j] := aYoil[i];
inc(j);
end;
aPart1 := f근무스케줄(aReadIn3H[2], 1);
aPart2 := f근무스케줄(aReadIn3H[2], 2);
aPart3 := f근무스케줄(aReadIn3H[2], 3);
j := 5;
for nCycle := 1 to 3 do
begin
i := 5;
while i <= Length(aReadManData) do
begin
if TryStrToInt(aReadManData[i], isInteger) then
begin
if aYok[nYokCheckCount] = aReadManData[i - 5] then
begin
if StrToInt(aReadManData[i]) = nCycle then
begin
ExcelWorkSheet.Cells[j, 1] := aReadManData[i];
ExcelWorkSheet.Cells[j, 2] := aReadManData[i - 1];
ExcelWorkSheet.Cells[j, 3] := aReadManData[i - 3];
inc(j);
end;
end;
end;
i := i + 15;
end;
end;
j := 5;
for nCycle := 1 to 3 do
begin
i := 5;
k := 4;
while i <= Length(aReadManData) do
begin
if TryStrToInt(aReadManData[i], isInteger) then
begin
if aYok[nYokCheckCount] = aReadManData[i - 5] then
begin
if StrToInt(aReadManData[i]) = nCycle then
begin
n3H1 := f쉬는지정휴무(aReadManData[i - 4]);
n3H2 := f근무지정휴무(aReadManData[i - 4]);
tmpValue := StrToInt(aReadManData[i]);
case tmpValue of
1:
begin
for m := 1 to tmpDay do
begin
if m = n3H1 then
begin
ExcelWorkSheet.Cells[j, k].Font.Color := clBlue;
ExcelWorkSheet.Cells[j, k] := '●';
inc(k);
end
else if m = n3H2 then
begin
ExcelWorkSheet.Cells[j, k].Font.Color := clRed;
ExcelWorkSheet.Cells[j, k] := '■';
inc(k);
end
else
begin
ExcelWorkSheet.Cells[j, k] := aPart1[m - 1];
inc(k);
end;
end;
end;
2:
begin
for m := 1 to tmpDay do
begin
if m = n3H1 then
begin
ExcelWorkSheet.Cells[j, k].Font.Color := clBlue;
ExcelWorkSheet.Cells[j, k] := '●';
inc(k);
end
else if m = n3H2 then
begin
ExcelWorkSheet.Cells[j, k].Font.Color := clRed;
ExcelWorkSheet.Cells[j, k] := '■';
inc(k);
end
else
begin
ExcelWorkSheet.Cells[j, k] := aPart2[m - 1];
inc(k);
end;
end;
end;
3:
begin
for m := 1 to tmpDay do
begin
if m = n3H1 then
begin
ExcelWorkSheet.Cells[j, k].Font.Color := clBlue;
ExcelWorkSheet.Cells[j, k] := '●';
inc(k);
end
else if m = n3H2 then
begin
ExcelWorkSheet.Cells[j, k].Font.Color := clRed;
ExcelWorkSheet.Cells[j, k] := '■';
inc(k);
end
else
begin
ExcelWorkSheet.Cells[j, k] := aPart3[m - 1];
inc(k);
end;
end;
end;
end;
inc(j);
end;
end;
end;
k := 4;
i := i + 15;
end;
end;
Except
fmInfoProgress.Hide;
MessageDlg('파일 저장 실패!', MtWarning, [mbok], 0);
ExcelWorkBook.Close;
ExcelApp.Quit;
ExcelApp := unAssigned;
Abort;
end;
end;
ExcelWorkSheet := ExcelApp.WorkBooks[1].Sheets[1].Select;
ExcelWorkSheet := ExcelApp.ActiveSheet;
ExcelWorkBook.SaveAs(iFilePath + DateToStr(tmpDate) + ' ' + strFileName);
ExcelWorkBook.Close;
ExcelApp.Quit;
ExcelApp := unAssigned;
fmInfoProgress.Hide;
showMessage('기안용 엑셀파일이 저장 되었습니다.');
end;
Application.ProcessMessages;
fmInfoProgress.Show;
즐거운 프로그래밍 하시구요..