Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Office Assistant (VBA/Word/2003 SP2)

    I have two installations that are behaving differently.

    The code shown below is in a procedure that is called by AutoExec.Main in the first add-in loaded on Launching. This is common to both machines as are all add-ins.

    Machine A is operating on a small LAN. As part of the startup procedure, folders on the LAN are interrogated for content (Dir("T:foldername*.*")

    Machine B is operating through a VPN to a remote LAN which has the same data and folder structure in the interrogated area.

    When the user launches Word by double clicking a document icon:
    <UL><LI>On Machine A; the document is opened irrespective of whether the code shown below is fired or not.
    <LI>On Machine B; the document does not open if the code shown below is fired.[/list]Is there a switch somewhere that will control this? Any insight will be greatly appreciated.

    <pre> With Application.Assistant
    .On = True
    .Visible = True
    .Move xLeft:=400, yTop:=100
    Set bln = .NewBalloon
    With bln
    .Mode = msoModeAutoDown
    .Heading = "Updated Macros"
    .Text = msg
    iOption = .Show
    End With
    Set bln = Nothing
    .Visible = False
    End With
    </pre>

    Regards
    Don

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Office Assistant (VBA/Word/2003 SP2)

    Have you checked if the problem occurs whenever you execute code in AutoExec.Main, or only if you display some kind of message, whether a message box or the Office assistant?

    If it's only when you display a message, you could experiment with delaying the message: put the code you now have in a macro, say ShowAssistant, and call it from AutoExec.Main like this:

    Application.OnTime Now + TimeValue("0:00:10"), "ShowAssistant"

  3. #3
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Office Assistant (VBA/Word/2003 SP2)

    Hans

    Thank you for that. I was trying to do the same thing with Sleep, which seems to be a viable command in Excel--though I've been unable to find any documentation on it.

    I ran into a spot of trouble with OnTime because I had another global template with the same module.procedure name combination; and the OnTime command ran the unintended code. I solved the problem with a procedure name change as I was unable to develop the proper context from the instructions in Help. I tried:

    Application.OnTime Now + TimeValue("0:00:10"), "Template.dot.module.procedure"; and
    Application.OnTime Now + TimeValue("0:00:10"), "Template.module.procedure".

    Both without success. Can you assist?
    Regards
    Don

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Office Assistant (VBA/Word/2003 SP2)

    Using a unique name is the best way. Or you can use ..., "Project.Module.Procedure" or ..., "Project.Procedure", where Project is the name of the VBA project in your template. Unfortunately, the default name for a template is TemplateProject, so unless you explicitly gave each project a unique name, this will fail too.

  5. #5
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Office Assistant (VBA/Word/2003 SP2)

    Sorry Hans, I'm still somewhat at a loss.

    Z9_Launch.dot contained both the OnTime command and the procedure intended to be run.

    _1_Macros.dot contained the procedure with the identical module.procedure name.

    Neither of the following commands seemed to run anything; though removing the reference to the project caused the procedure in _1_Macros.dot to run.

    <UL><LI>Application.OnTime Now + TimeValue("0:00:10"), "Z9_Launch.dot.module.procedure"; and
    <LI>Application.OnTime Now + TimeValue("0:00:10"), "Z9_Launch.module.procedure".[/list] Can you advise which of the above command strings is appropriate, if either.

    btw: I am having machine problems, so I'm somewhat suspicious that some of my problems are unique.

    Thanks for your patience.
    Regards
    Don

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Office Assistant (VBA/Word/2003 SP2)

    You can't use the file name of the template. The template, however, has a VBA project name which you can view and edit in the Properties panel whem you click on the template in the Project Explorer. If the VBA project is named MyProject, you can use

    Application.OnTime Now + TimeValue("0:00:10"), "MyProject.module.procedure"

    However, if you have never set the VBA project name explicitly, it probably has the default name TemplateProject, and since this is not unique, you're likely to run into problems. It's best to give the procedure a unique name, then you won't have to specify the template and module names:

    Application.OnTime Now + TimeValue("0:00:10"), "unique_procedure_name"

  7. #7
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Office Assistant (VBA/Word/2003 SP2)

    Thank you Hans
    All along I've been hitting the nail squarely on the thumb.
    Regards
    Don

Posting Permissions

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