Results 1 to 11 of 11
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Shortcut with switches (Office XP SP-2)

    I have made shortcuts to open both a doc -file and a dot -file and it works OK as long as I have access to the folder where the target is located.

    For another situation, having the target in SharePoint, I had hoped to be able to add a switch to the target path in the shortcut in order to open the file such that the Document_Open macro starts. But so far I haven't been able to find which switches is possible to use in a shortcut.

    Can anyone help?

    Bjorn

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Shortcut with switches (Office XP SP-2)

    The topic "Control what happens when you start Word," which you can find in help by searching for startup, lists the command-line switches. These would seem to be as valid in a .lnk file as on the Start>Run line, but I haven't tried them. I doubt they'd be of any use in a .url file (the other kind of "shortcut" or should I say "favorite").

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Shortcut with switches (Office XP SP-2)

    Thanks jscher2000,
    It is sometimes (very often) difficult to find what one are looking for in Help.

    You are right it did not work for an URL.

    My problem is that a user in SharePoint are not allowed to open a document with a normal shortcut. The user must be an Author to be able to open the document.

    SharePoint problem!!

    Bjorn

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Shortcut with switches (Office XP SP-2)

    Is there any way to solve the problem with a pre-loaded global template that would sense new documents being opened from SharePoint and run their Document_Open procedure for them?

    If not, I don't understand how Microsoft plans to take over this market...

  5. #5
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Shortcut with switches (Office XP SP-2)

    Good morning (6:50 am) jscher2000

    I agree, Microsoft doesn't seem to have understood this situation. I have been looking for solutions to this
    problem, but in vain. I haven't found any place in Microsoft's web pages where I can distinctly report or
    ask for solutions, though I have been reporting this on several occasions. It is very difficult to get
    in contact with Microsoft in order to discuss such things. We are also in a situation where we
    can't just switch to other SW suppliers(pitty!!!!).

    Using a Global template, Yes I am using one where I have a menu to choose the template to be used for
    different purposes. If a macro can sense as you describe, it would probably solve the situation.

    A document opened in Word, from a browser, will always have the name:
    Document in Microsoft Internet Explorer
    This I have taken advantage of and created a code that starts when someone click SaveAs.
    This procedure opens the actual document and the Document_Open macro will run. Here is my code:

    <pre>Sub OpenDocTemplForEditing()

    Dim RealDoc As Document
    If ActiveDocument.Name = "Document in Microsoft Internet Explorer" Then
    NewDoc = ActiveDocument.CustomDocumentProperties("FileFULLN AME")

    Set RealDoc = Documents.Open(FileName:=NewDoc)

    Documents("Document in Microsoft Internet Explorer").Close savechanges:=False
    RealDoc.Activate
    ThisDocument.Saved = True
    Else

    If ActiveDocument.ReadOnly = False Then
    If ProtectHandler.App Is Nothing Then
    Register_Event_Handler
    End If

    End If
    Exit Sub
    End If

    If RealDoc.ReadOnly = True Then
    FileSaveAs
    If ProtectHandler.App Is Nothing Then
    Register_Event_Handler
    End If
    Exit Sub
    ThisDocument.Saved = True
    End If

    If ProtectHandler.App Is Nothing Then
    Register_Event_Handler
    End If
    End Sub</pre>


    (The code: Register_Event_Handler, together with an EventClassModule, is there to prevent the user to access the Header/Footer, instead the UserForm for that template opens.)

    If you could give me some help to be able to sense when a document is opened from Wind Explorer/SharePoint I would appreciate it very much.

    Thanks
    Bjorn

  6. #6
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Shortcut with switches (Office XP SP-2)

    I can't replicate your document name. Is that for a document created fresh from a template (i.e., the equivalent of Document1)?

    Anyway, when opening an existing document in the browser, I can check the path to see if it starts with http://, a pretty good sign it's open in IE (though certainly not definitive). I couldn't access the ActiveWindow.Caption at all. The event did not fire if I opened the document in MS Word.

    For what it's worth, I attach my experimental template. You need to run the Init procedure before testing.
    Attached Files Attached Files

  7. #7
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Shortcut with switches (Office XP SP-2)

    Thanks,

    The document opened from SharePoint (<filename>.doc) is a document created with a Word Template and then stored in SharePoint.

    The procedure code I sent you is located in the template's ThisDocument.
    The code line: NewDoc = ActiveDocument.CustomDocumentProperties("FileFULLN AME")
    gets the http- address of the "Document in Microsoft Internet Explorer", which is shown on the screen.

    That means I use the http-address to open the real document, <pathfilename>.doc,
    I have a procedure Sub FileSaveAs() which starts the procedure I sent (Sub OpenDocTemplForEditing())

    I will test your code in the ziped file.

    Regards
    Bjorn

  8. #8
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Shortcut with switches (Office XP SP-2)

    Hi,

    Could not get it working.

    I did as follows:
    In "DocOpenEventTest.dot" I created an AutoOpen procedure in order to start "InitAppEvents"
    then stored the dot file in the Startup folder for Word; no extra code was written, contains only your Msgbox
    Started Word, (the AutoOpen should initiate the "InitAppEvents")
    Then I opened a document from SharePoint
    No message popped up

    I also opened the dot-file and run the init procedure to be sure that it was initiated and hoping that
    Private Sub appWord_DocumentOpen(ByVal Doc As Document) would run when opening a document from a browser
    But nothing happened.

    About the argument (ByVal Doc As Document):
    may be As Document is wrong? The "file" which is opened from SharePoint may be another category(?)

    To get hold of the http address I have stored the address in a customproperty when I saved the document in SharePoint using:
    ActiveDocument.CustomDocumentProperties("FULLNAME" ).
    This way I know the path when the document is opened as "Document in Microsoft Internet Explorer"

    Well may be it is not possible to fire any event when opening from a browser(?)

    I have earlier modified a key in the Registry such that opening a document in a browser opens the real document but still without running the Document_Open macro.

    I shall try your code after changing the registry key.

    Bjorn

  9. #9
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Shortcut with switches (Office XP SP-2)

    I changed the registry key:HKEY_LOCAL_MACHINE/SOFTWARE/Classes/Word.Document.8 from value "9" to value hexa "a"

    But nothing happened.

    I'll invite Bill Gates on a cup of coffee ....................

    Bjorn

  10. #10
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Shortcut with switches (Office XP SP-2)

    > Well may be it is not possible to fire any event when opening from a browser(?)

    I am beginning to think this is the case. Unfortunately, I have so little experience with it, it's hard to tell if my failures are due to my misunderstanding or the software design.

  11. #11
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    ASKER, Norway
    Posts
    277
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Shortcut with switches (Office XP SP-2)

    Good morning jscher2000!

    I don't think you have made any failure, it might be that I do not understand the way to do it properly.
    My self I do know very little about browsers and it looks to me that a not many knows anything more than me (thats not the truth).
    I'm will be surprised if there are no events that occur when opening a file in a browser, but may be the event cannot be handled by Word.

    I have been thinking to propose that WOODY's Lounge should start a group for e.g. SharePoint and related SW. A good reason for starting a new group is that Microsoft have many SW products and they all are more and more getting integrated in the way that they can work together. Then discussion, like on WOODY's Lounge, will become "integrated" as well, that is to say that to solve problems one need to know more about the other programs (products). Where do I send such a proposal? So far I think I can deliver a message in the FAQ site.

    I have been searching on other groups as well, specially Microsoft's for SharePoint and second on MS D2D, and first of all there are not many that have the proper knowledge or who will comment to my questions. WOODY's are the best!!

    Well, I will continue searching and trying your code in different ways.
    I got a question from MS D2D right now and will follow up on this one allthough it was not regarding this matter.

    Have a nice day.

    Best from
    Bjorn

Posting Permissions

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