P
Peter
My question is. Why can't I use F9 to generate an event while I can use F5,
F6, F7 and F8
The code i am using is:
Sub autoopen()
' so the user only has to click once on the macro field
Options.ButtonFieldClicks = 1
'define f5-f6-f7 to allow them to run the macros
Application.CustomizationContext = ThisDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF9),
KeyCategory:=wdKeyCategoryCommand, Command:="RubricHelp"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF6),
KeyCategory:=wdKeyCategoryCommand, Command:="toggleStandard"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF5),
KeyCategory:=wdKeyCategoryCommand, Command:="decrement"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF7),
KeyCategory:=wdKeyCategoryCommand, Command:="increment"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF8),
KeyCategory:=wdKeyCategoryCommand, Command:="addRescale"
End Sub
Any assistance gratefully received ...
The background is:
I have a small application for an automatic marking rubric that uses VBA to
allow function keys to highlight standards, add and resale marks. It uses VBA
and I want ti to work on Word for windows and Word 2004 for Mac.
I've sorted out most of the issues eg.
* use function keys rather than buttons on a userform to initiate procedures
* use macrofield hyperlink in the document rather than activex button to
iniate a prcedure
* don't use things that are not supprted on VBA mac e.g. INSTRREV or ROUND
* make sure that platform specific code is in seperate procedures even if it
is cloaked with If statements
The applicaiton is at
http://www.usq.edu.au/users/evansp/browse\eMarking_Assistant/Marking_Rubric_dev.doc
and part of the crossplatform code is below
Below is an exmaple of the cross platform code:
Public Sub ShowMarkingRubricToolbar()
If System.OperatingSystem = "Macintosh" Then
showMarkingRubricFunctionKeysMac
Else
ShowMarkingRubricToolbarWin
End If
End Sub
Sub showMarkingRubricFunctionKeysMac()
' show a message box if Macintosh
Dim themessage As String
Dim btns As String
Dim prompt As String
Dim result As String
Dim title As String
title = "You are using a Macintosh computer"
themessage = "Sorry. The toolbar can't be displayed in Word for the
Macintosh." & vbCrLf
themessage = themessage & vbCrLf
themessage = themessage & "But you can use fuction keys to operate
the marking rubric by placing your cursor in the" & vbCrLf
themessage = themessage & "row for the relevant standard and then
pressing the following function keys:" & vbCrLf
themessage = themessage & " F1 - to to the support web site" &
vbCrLf
themessage = themessage & " F5 - decrease the mark by 10%" & vbCrLf
themessage = themessage & " F6 - Select or unselect the standard"
& vbCrLf
themessage = themessage & " F7 - increase the mark by 10%" & vbCrLf
themessage = themessage & " F8 - Add and rescale the marks" & vbCrLf
btns = vbOKOnly
result = MsgBox(themessage, btns, title)
End Sub
Sub ShowMarkingRubricToolbarWin()
'show the marking rubric toolbar if using Windows
Dim UFrm As MarkingRubric
Set UFrm = New MarkingRubric
With UFrm
.Show vbModeless
End With
End Sub
F6, F7 and F8
The code i am using is:
Sub autoopen()
' so the user only has to click once on the macro field
Options.ButtonFieldClicks = 1
'define f5-f6-f7 to allow them to run the macros
Application.CustomizationContext = ThisDocument
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF9),
KeyCategory:=wdKeyCategoryCommand, Command:="RubricHelp"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF6),
KeyCategory:=wdKeyCategoryCommand, Command:="toggleStandard"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF5),
KeyCategory:=wdKeyCategoryCommand, Command:="decrement"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF7),
KeyCategory:=wdKeyCategoryCommand, Command:="increment"
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyF8),
KeyCategory:=wdKeyCategoryCommand, Command:="addRescale"
End Sub
Any assistance gratefully received ...
The background is:
I have a small application for an automatic marking rubric that uses VBA to
allow function keys to highlight standards, add and resale marks. It uses VBA
and I want ti to work on Word for windows and Word 2004 for Mac.
I've sorted out most of the issues eg.
* use function keys rather than buttons on a userform to initiate procedures
* use macrofield hyperlink in the document rather than activex button to
iniate a prcedure
* don't use things that are not supprted on VBA mac e.g. INSTRREV or ROUND
* make sure that platform specific code is in seperate procedures even if it
is cloaked with If statements
The applicaiton is at
http://www.usq.edu.au/users/evansp/browse\eMarking_Assistant/Marking_Rubric_dev.doc
and part of the crossplatform code is below
Below is an exmaple of the cross platform code:
Public Sub ShowMarkingRubricToolbar()
If System.OperatingSystem = "Macintosh" Then
showMarkingRubricFunctionKeysMac
Else
ShowMarkingRubricToolbarWin
End If
End Sub
Sub showMarkingRubricFunctionKeysMac()
' show a message box if Macintosh
Dim themessage As String
Dim btns As String
Dim prompt As String
Dim result As String
Dim title As String
title = "You are using a Macintosh computer"
themessage = "Sorry. The toolbar can't be displayed in Word for the
Macintosh." & vbCrLf
themessage = themessage & vbCrLf
themessage = themessage & "But you can use fuction keys to operate
the marking rubric by placing your cursor in the" & vbCrLf
themessage = themessage & "row for the relevant standard and then
pressing the following function keys:" & vbCrLf
themessage = themessage & " F1 - to to the support web site" &
vbCrLf
themessage = themessage & " F5 - decrease the mark by 10%" & vbCrLf
themessage = themessage & " F6 - Select or unselect the standard"
& vbCrLf
themessage = themessage & " F7 - increase the mark by 10%" & vbCrLf
themessage = themessage & " F8 - Add and rescale the marks" & vbCrLf
btns = vbOKOnly
result = MsgBox(themessage, btns, title)
End Sub
Sub ShowMarkingRubricToolbarWin()
'show the marking rubric toolbar if using Windows
Dim UFrm As MarkingRubric
Set UFrm = New MarkingRubric
With UFrm
.Show vbModeless
End With
End Sub