Hide Ribbon In XLS Workbook When Using Excel 2007

A

AG

I am familiar with the ribbon, custom ribbon, callbacks, etc. from working
with the ribbon in Access 2007, but am not that familiar with Excel.

When opening an xls (Excel 2003) workbook using Excel 2007, is there a way
to either hide the ribbon completely or load my own custom ribbon? If so,
how?

Also how can I disable some of the Office Button functions, like I can in
Access?

Thanks for any assisstance.
 
H

Homey

When opening an xls (Excel 2003) workbook using Excel 2007

not possible to have ribbonx in a 2003 workbook but 2003 workbook can open a
excel 2007 add-in when it is running in excel 2007. See especially example
2 here:

http://www.rondebruin.nl/compatiblemenu.htm

to hide all of ribbon see code near end this page

http://www.rondebruin.nl/ribbon.htm


|I am familiar with the ribbon, custom ribbon, callbacks, etc. from working
| with the ribbon in Access 2007, but am not that familiar with Excel.
|
| When opening an xls (Excel 2003) workbook using Excel 2007, is there a way
| to either hide the ribbon completely or load my own custom ribbon? If so,
| how?
|
| Also how can I disable some of the Office Button functions, like I can in
| Access?
|
| Thanks for any assisstance.
| --
|
| AG
| Email: npATadhdataDOTcom
|
|
|
|
 
A

AG

Homey said:
not possible to have ribbonx in a 2003 workbook but 2003 workbook can open
a
excel 2007 add-in when it is running in excel 2007. See especially
example
2 here:

http://www.rondebruin.nl/compatiblemenu.htm

to hide all of ribbon see code near end this page

http://www.rondebruin.nl/ribbon.htm


|I am familiar with the ribbon, custom ribbon, callbacks, etc. from
working
| with the ribbon in Access 2007, but am not that familiar with Excel.
|
| When opening an xls (Excel 2003) workbook using Excel 2007, is there a
way
| to either hide the ribbon completely or load my own custom ribbon? If
so,
| how?
|
| Also how can I disable some of the Office Button functions, like I can
in
| Access?
|
| Thanks for any assisstance.
| --
|
| AG
| Email: npATadhdataDOTcom
|
|
|
|

Thanks Homey, that worked great. Even removed the Office button, which can't
be done in Access.

Is there any way to load a custom ribbon without using an addin?
In Access there is a loadfromtext method to load a custom ribbon.
I would like to be able to store the xml for my custom ribbon in a hidden
sheet and load it from there.
 
T

Tim Li - MSFT

Hello AG,

If you only work with a Excel 2003 Workbook we'll not be able to customize
the Ribbon in Excel 2007 except we use an COM add-in.

To your scenario I have two suggestions, however, both of them are
workarounds:

1st, to save your Excel 2003 Workbook as Excel 2007 format, because Excel
2007 Workbook formats are actually zipped XML, and we could easily build a
customized Ribbon by using a tool named "CustomUIEditor", you can refer to
these links for the detailed steps:

Extend The 2007 Office System With Your Own Ribbon Tabs And Controls
http://msdn.microsoft.com/en-us/magazine/cc163469.aspx

Custom UI Editor Tool
http://openxmldeveloper.org/articles/customuieditor.aspx

Second option is, as you know , to build a COM add-in. You could get
started from here:

Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
http://msdn.microsoft.com/en-us/library/aa338202.aspx


Best regards,
Tim Li
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
 
A

AG

Tim Li - MSFT said:
Hello AG,

If you only work with a Excel 2003 Workbook we'll not be able to customize
the Ribbon in Excel 2007 except we use an COM add-in.

To your scenario I have two suggestions, however, both of them are
workarounds:

1st, to save your Excel 2003 Workbook as Excel 2007 format, because Excel
2007 Workbook formats are actually zipped XML, and we could easily build a
customized Ribbon by using a tool named "CustomUIEditor", you can refer to
these links for the detailed steps:

Extend The 2007 Office System With Your Own Ribbon Tabs And Controls
http://msdn.microsoft.com/en-us/magazine/cc163469.aspx

Custom UI Editor Tool
http://openxmldeveloper.org/articles/customuieditor.aspx

Second option is, as you know , to build a COM add-in. You could get
started from here:

Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
http://msdn.microsoft.com/en-us/library/aa338202.aspx


Best regards,
Tim Li
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

Tim,

Thanks for the reply.
My client will be distributing the workbook to his customers and it must
remain in 2003 format with no add-ins required.
Also, the workbook will be used with a screen reader.
Hiding the ribbon completely will be ok, if I can find some way to provide a
couple of additional menu-like functions.
A simple row of buttons would be fine, but I haven't found a method of
setting focus to a command button.
Basically, anything that a user could tab to and press enter to activate a
function would work.

Any suggestions?
 
H

Homey

you can add buttons to sheet but no possble to pres Tab to put focus on a
button. users have to click button. so it seem you connot have exactly what
you want. so pick best of-

-Do 2 versions, one for xl2003 (xls) and one for xl2007 (xlsm).
-Do one version (xls) but have it open XLAM when use in xl2007 (exampl 2 on
Ron site)
-Have one version (xls) and (if it have menu) tell users to find this menu
on xl2007 Add-ins tab.
-Use buttons which users muct click

that all i can think of.


|
| | > Hello AG,
| >
| > If you only work with a Excel 2003 Workbook we'll not be able to
customize
| > the Ribbon in Excel 2007 except we use an COM add-in.
| >
| > To your scenario I have two suggestions, however, both of them are
| > workarounds:
| >
| > 1st, to save your Excel 2003 Workbook as Excel 2007 format, because
Excel
| > 2007 Workbook formats are actually zipped XML, and we could easily build
a
| > customized Ribbon by using a tool named "CustomUIEditor", you can refer
to
| > these links for the detailed steps:
| >
| > Extend The 2007 Office System With Your Own Ribbon Tabs And Controls
| > http://msdn.microsoft.com/en-us/magazine/cc163469.aspx
| >
| > Custom UI Editor Tool
| > http://openxmldeveloper.org/articles/customuieditor.aspx
| >
| > Second option is, as you know , to build a COM add-in. You could get
| > started from here:
| >
| > Customizing the 2007 Office Fluent Ribbon for Developers (Part 1 of 3)
| > http://msdn.microsoft.com/en-us/library/aa338202.aspx
| >
| >
| > Best regards,
| > Tim Li
| > Microsoft Online Community Support
| >
| > Delighting our customers is our #1 priority. We welcome your comments
and
| > suggestions about how we can improve the support we provide to you.
Please
| > feel free to let my manager know what you think of the level of service
| > provided. You can send feedback directly to my manager at:
| > (e-mail address removed).
| >
|
| Tim,
|
| Thanks for the reply.
| My client will be distributing the workbook to his customers and it must
| remain in 2003 format with no add-ins required.
| Also, the workbook will be used with a screen reader.
| Hiding the ribbon completely will be ok, if I can find some way to provide
a
| couple of additional menu-like functions.
| A simple row of buttons would be fine, but I haven't found a method of
| setting focus to a command button.
| Basically, anything that a user could tab to and press enter to activate a
| function would work.
|
| Any suggestions?
|
| --
|
| AG
| Email: npATadhdataDOTcom
|
|
|
 
A

AG

Thanks Homey, but I don't think client will accept either.
Is it possible to run code (macro) when user double clicks or presses Enter
on a particular cell?
If so, can you point me to an example?
 
T

Tim Li - MSFT

Hello AG,

To your question "Is it possible to run code (macro) when user double
clicks or presses Enter?"

There's no support in Excel Object Model that could listen the KeyPress
event on a cell, however, it is possible to run code when user double click
on a particular cell. The code is shows as below:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$E$9" Then
MsgBox ""
End If
End Sub

Besides above solution, there's another way to deal with this scenario, we
could create a UserForm in VBA put, buttons in this UserForm, make it like
an Excel 2003 style toolbar.

When use, user could use a shortcut to show this UserForm as modal in
Excel, then he can tab through the buttons, last he could press Space key
to perform the click action.

Detailed steps for this solution:
1 Create UserForm in Excel 2007 please refer to this link:
http://msdn.microsoft.com/en-us/library/dd890502(office.11).aspx#dnofftalk_L
istVBAProcsfromRibbonButton_CreatingtheUserForm

2: Create a macro in Excel 2007 to show this UserForm.

1. On the Tools menu in Microsoft Excel, point to Macro, and then click
Visual Basic Editor.
2. On the Insert menu, click Module.
3. Type or copy your code into the code window of the module.
4. If you want to run the macro (macro: An action or a set of actions
that you can use to automate tasks. Macros are recorded in the Visual Basic
for Applications programming language.) from the module window, press F5.
5. When you're finished writing your macro, click Close and Return to
Microsoft Excel on the File menu.

Code should like this:
Sub Macro1()
'Assume the UserForm just be created is named UserForm1
UserForm1.Show
End Sub

3: Assign Macro1 a shortcut.
1. Go to View tab in Ribbon
2. Click on Macros
3. Select Macro1 in Macros list then click Options...

Best regards,
Tim Li
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
 
A

AG

Tim,

A user form could work well as a 'toolbar'.
The workbook must be in 2003 format.
Would a user form work the same when run under Excel 2003 and 2007?
It would be better if it could always be visible and there was a way to set
focus to it. Is that possible?.
Many of the end users for the worksheet are visually challanged and will be
using a screen reader.
 
T

Tim Li - MSFT

Hello AG,

Yes the workbook would remain Excel 2003 format, and it will works fine in
Excel 2007.

Also it is possible to make the User Form always be visible and we'll be
able to set focus to it, the detailed solution is shows as below:

To make User Form visible at Workbook open we could take use of Workbook
Open event:
Private Sub Workbook_Open()
UserForm1.Show vbModeless
End Sub

To set focus we have two options:
1st. The simple way. We could write a macro as below and assign a shortcut
to the macro.
Sub Setfocus()
UserForm1.Hide
UserForm1.Show vbModeless
End Sub

2nd.This method will need some Windows APIs to achieve the same.
First we need to insert a new class in the VB Editor and paste the
following code into the class.

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As
Long) As Long

Public Sub ActivateUserForm()
SetForegroundWindow DialogHWnd(UserForm1)
End Sub

Public Function DialogHWnd(ByRef WindowObject As Object) As Long
DialogHWnd = GetWindowFromTitle(WindowObject.Caption, "ThunderDFrame")
End Function

Public Function GetWindowFromTitle(ByVal WindowTitle As String, Optional
ByVal ClassName As String) As Long
hwnd = FindWindow(ClassName, WindowTitle)
GetWindowFromTitle = hwnd
End Function

Then we write a macro and assign a shortcut, the same as the first method:
Sub activewindow()
Dim k As New Class1
k.ActivateUserForm
End Sub

Best regards,
Tim Li
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top