Excel 2010 lost it’s ribbon program line when I run It from other Application. WHY?

Jiurasic

Board Regular
Joined
Sep 22, 2007
Messages
86
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?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top