Roger Govier
New member
- Joined
- Mar 21, 2011
- Messages
- 113
- Reaction score
- 0
- Points
- 0
Hi
Using XL2007, I have an application where most of the time the users will have the Ribbon minimised.
However, when I want them to be in a Print Preview mode, following a button click, with a report that I have formatted, I need the Ribbon to be maximised, otherwise you don't see all the Preview options.
I can identify that the ribbon is minimised easily enough with a test of Commandbars("Ribbon").Height, but when then trying to do sendkeys, there is either no effect whatsoever, or I get the VBE Help (as though the Control hadn't been sent in from of the F1.
This has been driving me nuts all morning.
I have tried it with adding a Wait to the Sendkeys event, but that makes no difference.
What am I doing wrong?
Using XL2007, I have an application where most of the time the users will have the Ribbon minimised.
However, when I want them to be in a Print Preview mode, following a button click, with a report that I have formatted, I need the Ribbon to be maximised, otherwise you don't see all the Preview options.
I can identify that the ribbon is minimised easily enough with a test of Commandbars("Ribbon").Height, but when then trying to do sendkeys, there is either no effect whatsoever, or I get the VBE Help (as though the Control hadn't been sent in from of the F1.
This has been driving me nuts all morning.
Code:
Sub Max_Ribbon()
If Application.CommandBars("Ribbon").Height < 80 Then
With ThisWorkbook.ActiveSheet
SendKeys "^{F1}"
End With
End If
End Sub
I have tried it with adding a Wait to the Sendkeys event, but that makes no difference.
What am I doing wrong?