Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thinking caps on...

    Ok, you geniuses out there, is there a way for Word 97/2000 VBA to know when a user opens a document via the recents list, by d-clicking an email attachment or by d-clicking a filename in a folder list?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    Yes.

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    Chris,

    Such a sparse response has left me with less knowledge than before. I see several items on your page, but I have no idea which one you are directing me toward. Could I get you to maybe point me a little closer to your suggested solution? Many thanks in advance.

    p.s. nice to have you back on the forum.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    >p.s. nice to have you back on the forum.

    Aw, c'mon Kev, you're regretting it already!



    OK. It's Friday and you said "Thinking Caps ON", so I did.

    It didn't take me long to work out there there MUST be a way for Word to determine almost anything at all, let alone a specific such as "Now where did THIS come from???!??!!?". Code from Redmond is worse than mine, so they must have more debugging and trace calls than me, so they certainly have a trace available to them of what's been going on recently (How else can you produce what we used to call a core-dump?).

    So they must have a way of knowing the avenue-of-approach for the document in hand, even if it would mean searching backwards through the trace log for related events.

    I'm now thinking about how *I* would work out from whence it came.

    I recall that one can load a file from the MRU file list.Like this:
    <pre> RecentFiles(4).Open
    </pre>


    One method might be to hijack the RecentFiles feature (don't know how yet) and save that event in an application file, such as an INI file.


    I strive .....



    P.S. Why did you use the plural "geniuses"?

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Thinking caps on...

    Hi Chris,

    Bear in mind that there are many traces/internal markers that Word uses in doing its business, that are not visible nor available as objects in either the user interface nor VBA.
    The fact that Word may "know" something, unfortunately doesn't necessarily mean that we can get our hooks into it. That's where the creativity comes in I guess but that doesn't always mean a solution can be obtained.

    PS: I think Kevin was being generous in his use of the term...[img]/w3timages/icons/smile.gif[/img]

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    >I think Kevin was being generous in his use of the term

    I know. The Singular would have been just as effective. (vbg!)


    OK. Back to business.


    Is it possible to hijack a VBA command the same way we used to hijack Word6 commands with a WordBasic macro?

  7. #7
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Thinking caps on...

    Do you mean built-in Word commands?
    Sure. One way to view all of these is to go to Tools>Macro>Macros, and select Word Commands in "Macros in:".

  8. #8
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    Chris,

    Yes, in exactly the same way- though sometimes there might be a bit of guesswork to find the command.

    Most times it's traightforward though.

    So a "Sub FileSaveAs" executes when the user selects "File, Save As".

    The guesswork can come in for the buttons.

    For instance, "FilePrint" is the routine to hijack for the user selecting "File, Print", but "FilePrintDefault" is the print button on the toolbar.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  9. #9
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Thinking caps on...

    Kevin

    Why is it important to know how they open it? Are you tracking how a user works just out of spite or is there a purpose to it. Certainly if the file is opened with a double-click from outlook then it is located in a temp file and will be deleted when it closes. That would certainly be traceable.

    When do you want to collect the information - After opening the file or whilst opening the file?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  10. #10
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    Andrew,

    Thanks for getting this thread back on topic.

    (No offense guys, but I am trying to solve a biggie here.)

    There's no spite or malice or big-anything here. I could care less what they open and when, etc. Here's the rub:

    I have replaced the Word FileOpen dialog for EVERY file opened in order to provide a password (this "feature" was requested by a business unit and is important) so that user's do not see the "Read Only" prompt when opening files. (This is accomplished in a global template all uses have installed -- they cannot disable it.) There are other things going on in my FileOpen sub too. Opening a doc from Recents or from attachments by-passes the Word FileOpen "method", so Word just opens these docs via some method programmers have no access too. I was hoping I was wrong about not having access to the method (or event) that opens these docs. But I'm beginning to think it is not possible.

    As far as "when" I want the information -- the same time the FileOpen dialog method/event gets it to me. In other words, I need to control the .execute method of the FileOpen "dialog". I hope I'm making sense. If not, oh well. I may be in over my head anyway.

    Thanks for posting
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  11. #11
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,853
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Thinking caps on...

    It seems odd to allow everyone to bypass the password automatically. I would try explaining to your users how network security works and give your IT dudes something to do instead. Having the password in a global add-in also allows anyone to read the code and figure out the password.

    However, does the AutoOpen macro get in there fast enough to stop the dialog from appearing? I am assuming you are currently using code such as

    Documents.Open FileName:=sFile, ReadOnly:=False, _
    WritePasswordDocument:="password"

    Failing that, can you hijack the Password dialog itself? There must be an event which calls that dialog. If you can hijack that then you are set to cover all methods of opening the files. Naturally that would be a security hole and I hope Microsoft have not enabled that.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  12. #12
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Thinking caps on...

    Kevin,

    An AutoOpen in Normal.dot appears to run when every file gets opened, no matter whether via FileOpen, MRU or Windows Explorer.

    The exception to this would be if the document has an attached template that is other than Normal.dot, and that attached template has its own AutoOpen procedure - the AutoOpen in the attached template takes precedence.

    However if you have a Document_Open in the attached template and an AutoOpen in Normal.dot, they both run (with the AutoOpen in Normal.dot firing first, which should be helpful in your situation).

    Just a quick test; not necessarily definitive....

    Gary

  13. #13
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    > An AutoOpen in Normal.dot

    Interesting.

    This would put you at the mercy of anyone deleting the local Normal.dot, right? Unless the Word installation pointed to a network-secure location where the administrator stores the Normal.dot.

  14. #14
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    An AutoOpen in Normal.dot is not my idea of a good time; however, I'll test this anyway. Any idea is helpful at this point.

    If a Normal.dot gets deleted then I'm back in the business of checking Normals for code. Remember, you helped me pitch that technique a while ago (for which I am grateful!)
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  15. #15
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thinking caps on...

    My sentiments exactly. I used to try to manage some code in user Normals, but Gary helped me overcome that poor practice. I see Andrew has posted again. Let's see what he has to say...
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Page 1 of 2 12 LastLast

Posting Permissions

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