Results 1 to 2 of 2
  1. #1
    Uranium Lounger
    Join Date
    Dec 2000
    Los Angeles Area, California, USA
    Thanked 0 Times in 0 Posts

    Word Command for Add to Work Menu (English(U.S.)/Word 2000)

    Hi Everyone:

    Does anyone know the VBA command for "Add to Work Menu"? I recorded a macro while adding a document to the work menu, but the macro only recorded my opening of a document & closing it. I couldn't find anything under WordCommands that looked like it would do the job.

    Thanks in advance.

  2. #2
    2 Star Lounger
    Join Date
    Jan 2001
    Melbourne, Victoria, Australia
    Thanked 0 Times in 0 Posts

    Re: Word Command for Add to Work Menu (English(U.S.)/Word 2000)


    Is this any help - its the "AddCurrentDocumentHere" macro from Word97
    Public Sub MAIN()
    Dim file$
    Dim N
    Dim numofmenus
    Dim count_
    Dim menuname$
    Dim Work
    Dim CurrentDocFileName$
    Dim x
    If WordBasic.Window() = 0 Or WordBasic.IsMacro() Then
    WordBasic.PrintStatusBar _
    "The command is not available because a document window is not active."
    GoTo theend
    End If
    Dim dlg As Object: Set dlg = WordBasic.DialogRecord.DocumentStatistics(False)
    WordBasic.CurValues.DocumentStatistics dlg
    file$ = dlg.Filename
    If WordBasic.[Left$](file$, 8) = "Document" Then

    Set dlg = WordBasic.CurValues.FileSaveAs
    N = WordBasic.Dialog.FileSaveAs(dlg)
    If N = -1 Then WordBasic.FileSaveAs dlg
    If N = 0 Then GoTo theend
    End If
    numofmenus = WordBasic.CountMenus(0, 0)
    For count_ = 1 To numofmenus
    menuname$ = WordBasic.[MenuText$](0, count_, 0)
    If InStr(menuname$, "Wor&k") <> 0 Then Work = 1
    Next count_
    If Work = 0 Then WordBasic.ToolsCustomizeMenuBar Position:=-1, _
    MenuText:="Wor&k", Context:=0, Add:=1
    CurrentDocFileName$ = WordBasic.[FileName$]()
    x = InStr(CurrentDocFileName$, "")
    If x = 0 Then GoTo theend
    WordBasic.ToolsCustomizeMenus MenuType:=0, Category:=1, _
    Name:="FileOpenFile", Menu:="Wor&k", _
    MenuText:=WordBasic.[FileNameInfo$](WordBasic.[FileName$](0), 3), _
    Add:=1, CommandValue:=CurrentDocFileName$, Context:=0
    End Sub


    If you have problems with this it will be because I have inserted VBA line breaks as suggested by the Lounge.

    Actually I would find the matching macro for Excel most useful if anyone can build it from the above code - it's beyond my capabilities.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts