Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VBA macro storage & document variables

71 views
Skip to first unread message

Fred Bartlett

unread,
Jun 11, 2002, 11:39:11 AM6/11/02
to
I have a template originally developed on Windows and now running,
more or less (well, less) on a Mac.

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

Howard Kaikow

unread,
Jun 11, 2002, 4:28:49 PM6/11/02
to
The no macro storage error could be from project references that need to be
reset.
I'd go into the VBIDE, clear and reset ALL the references.
--
http://www.standards.com/; Programming and support for Word macros,
including converting from WordBasic to VBA; Technical reviewing; Standards;
Product functional/design/specifications
------------------------------------------------
"Fred Bartlett" <vepxist...@netscape.net> wrote in message
news:ff30b903.02061...@posting.google.com...

John McGhie [MVP]

unread,
Jun 12, 2002, 7:48:02 AM6/12/02
to
Hi 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

0 new messages