When a document created with that template is opened, I get the 5981
error ("Could not open macro storage"). The problem is in here:
Function AddKey()
'
' Adds Key(s) to bindings; called by Document_Open and Document_New --
' that is, whenever a document is opened or created using this
template.
'
Dim myString As String
CustomizationContext = ActiveDocument.AttachedTemplate
KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, _
Command:="InsNumDispPict", _
KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyN)
KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, _
Command:="InsDispPict", _
KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyU)
On Error GoTo AK_Handler
'Comment out this line & no error occurs
DirPath = ActiveDocument.Variables.Item("DVDirPath").Value
Exit Function
AK_Handler:
If Not Err.Number = 5825 And Not Err.Number = 0 Then
MsgBox ("AddKey: " + VBA.Str(Err.Number) + Err.Description)
End If
End Function
Do document variables work differently under Macs and Windows?
Thanks,
Fred
This responds to article <ff30b903.02061...@posting.google.com>,
from "Fred Bartlett" <vepxist...@netscape.net> on 12/6/02 1:39 AM:
Your problem is in this bit:
KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, _
Command:="InsNumDispPict", _
KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyN)
I get a run-time error in Word v.X 5346 "Word cannot change the function of
the specified key."
There are some keys reserved for the Mac OS system that Word will not let
you play with.
Cheers
>
> Function AddKey()
> '
> ' Adds Key(s) to bindings; called by Document_Open and Document_New --
> ' that is, whenever a document is opened or created using this
> template.
> '
> Dim myString As String
> CustomizationContext = ActiveDocument.AttachedTemplate
> KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, _
> Command:="InsNumDispPict", _
> KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyN)
> KeyBindings.Add KeyCategory:=wdKeyCategoryCommand, _
> Command:="InsDispPict", _
> KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyU)
> On Error GoTo AK_Handler
> 'Comment out this line & no error occurs
> DirPath = ActiveDocument.Variables.Item("DVDirPath").Value
> Exit Function
> AK_Handler:
> If Not Err.Number = 5825 And Not Err.Number = 0 Then
> MsgBox ("AddKey: " + VBA.Str(Err.Number) + Err.Description)
> End If
> End Function
>
> Do document variables work differently under Macs and Windows?
>
> Thanks,
> Fred
--
Please post replies to the newsgroup to maintain the thread.
John McGhie, Microsoft MVP: Word for Macintosh and Word for Windows
Consultant Technical Writer
<jo...@mcghie-information.com.au>
+61 4 1209 1410; Sydney, Australia: GMT + 10 hrs