Hello!
I have a program, which consists of two parts. First part is my Delphi program “logo”, which runs an Excel file. This is the Delphi code:
procedure TForm1.Timer2Timer(Sender: TObject);
begin
timer2.Enabled :=false;
XL.Visible := true;
SetForegroundWindow(XL.hwnd);
Application.Terminate;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
try
timer1.Enabled :=false ;
//ShowMessage('dsd');
XL := CreateOleObject('Excel.Application');
// XL.Visible := false;
XL.WorkBooks.Open(GetCurrentDir+'\Modules\'+Program.xlsm');
timer2.Enabled :=true ;
except
raise Exception.Create('Mistake!');
end;
end;
Everything is working good. My Excel Application Run’s, but when It’s Load I try to hide all Excel Ribbons, columns And Rows name and others. User must think that he is working in some other program. To hide an Excel ribbon I use this code line in Workbook_Open event:
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"", " & False & ")"
And it’s hide Ribbon. But If I Run the Application by my Delphi program this VBA code also hide top line of Application (where I see the Application name and minimize and hide buttons). To make this Application top line visible I have to turn it on and Off by button (if I put this code to workbook_Open nothing happing’s):
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"", " & True & ")"
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"", " & False & ")"
or I must make right mouse click in Excel sheet, then I also see Application top line.
I want this Application top line be visible always, not when I only click by button on right mouse click….
How can I do that?
I have a program, which consists of two parts. First part is my Delphi program “logo”, which runs an Excel file. This is the Delphi code:
procedure TForm1.Timer2Timer(Sender: TObject);
begin
timer2.Enabled :=false;
XL.Visible := true;
SetForegroundWindow(XL.hwnd);
Application.Terminate;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
try
timer1.Enabled :=false ;
//ShowMessage('dsd');
XL := CreateOleObject('Excel.Application');
// XL.Visible := false;
XL.WorkBooks.Open(GetCurrentDir+'\Modules\'+Program.xlsm');
timer2.Enabled :=true ;
except
raise Exception.Create('Mistake!');
end;
end;
Everything is working good. My Excel Application Run’s, but when It’s Load I try to hide all Excel Ribbons, columns And Rows name and others. User must think that he is working in some other program. To hide an Excel ribbon I use this code line in Workbook_Open event:
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"", " & False & ")"
And it’s hide Ribbon. But If I Run the Application by my Delphi program this VBA code also hide top line of Application (where I see the Application name and minimize and hide buttons). To make this Application top line visible I have to turn it on and Off by button (if I put this code to workbook_Open nothing happing’s):
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"", " & True & ")"
Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"", " & False & ")"
or I must make right mouse click in Excel sheet, then I also see Application top line.
I want this Application top line be visible always, not when I only click by button on right mouse click….
How can I do that?