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

    macrocontainer.fullname in Startup (Word97SR2)

    Another puzzle. I have the macro below in an application template - Trail.DOT - which I have dragged into a startup folder after testing the template in its own folder.

    I run the macro and get a Run-Time error 438: Object doesn't support this property or method.

    Yet if I change "FullName" to "Name", the macro will run to completion.

    Why should VBE or whatever be worried about telling the full path and name of a template that is sitting in my startup folder?

    Running the template by File, Open in its home folder (c:GreavesTrail) works with both FullName and with Name.

    Running the template by File, Open in my StartUp folder (crogram FilesMicrosoft etc) works ONLY with Name.

    The MSKB http://support.microsoft.com/default.aspx?...kb;en-us;166498 indicates that there is a problem, and suggest opening the template to run the code, but that isn't a real solution, and appears not to work anyway.


    <pre>Public Sub WhoAmI()
    Call Initialize
    MsgBox MacroContainer.FullName
    End Sub
    </pre>


  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    By putting the template in your Word startup folder, it becomes a global template / add-in. Although the MSKB article is rather vague, I guess it means that the template is not fully initialized because it is loaded very early early in the load sequence of Word. By taking the module out of the startup folder and opening it normally, it is initialized properly. (If you leave it in your startup folder, then open it with File | Open, it is loaded when you start Word; the File | Open action only opens it in the Word interface.)

    By the way, the error still occurs in Word 2000 and 2002 aka XP.

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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    > not fully initialized because it is loaded very early early in the load sequence

    Hans, thanks for the reply. I agree with your comments (especially about "vague"), but what thwarts my imagination is why one can get the .Name but not the .Fullname of the macrocontainer when it is Global.

    Note too that even when loaded as a Global and subsequently opened for VBE editing, it will STILL fail to return the Fullname, but will return the Name.

    If it failed to return both .Name and .Fullname I'd be ticked off, but would not be left as puzzled as I am.


    Thanks for checking later versions for our edification.

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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    Chris,

    I was wrong in my previous reply, the explanation is different. If you put a template in the startup folder, it is loaded as an add-in. FullName is a property of the Document and Template objects, but not of the AddIn object, although Name is. Even if you view the code in the VBE, the template is still loaded as an add-in, therefore FullName is not valid. If you take the template out of the startup folder and open it, you will open it as a template, so FullName is valid.

  6. #5
    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: macrocontainer.fullname in Startup (Word97SR2)

    Assuming HansV has uncovered the reason

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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    Or, even easier, ThisDocument.FullName

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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    Apologies for the tardiness of replies. I am now the proud parent of the world's most BEAUTIFUL ginger cat, one year old, excellent behaviour. More details in the Cat-Lover's Forum.

    > FullName is a property of the Document and Template objects, but not of the AddIn object, although Name is.

    Thank you, Hans. To me that's just another great example of lack of standardization in design at MSoft.

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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    Apologies for the tardiness of replies. I am now the proud parent of the world's most BEAUTIFUL ginger cat, one year old, excellent behaviour. More details in the Cat-Lover's Forum.

    > MacroContainer is polymorphic between AddIn, Template, and Document

    Lovely. I could understand that.

    I put it in place as:
    <pre>Public Sub WhoAmI()
    Call Initialise
    MsgBox MacroContainer.Path & Application.PathSeparator & MacroContainer.Name
    End Sub
    </pre>


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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    > ThisDocument.FullName

    This too appears to work, although I am a little wary. I've been caught in the past when using a "Document'" object instead of a "Template" object, and vice-versa.

    I feel secure in using MacroContainer, because, somehow, it seems better to reflect what i really want to express - the container of the "WhoAmI" macro that is currently running.

  11. #10
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: macrocontainer.fullname in Startup (Word97SR2)

    It's a known problem that Macrocontainer does not work properly with templates that are global, or maybe just those in Startup directory, I feget.

    Use ThisDocument instead.

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

    Re: macrocontainer.fullname in Startup (Word97SR2)

    > Use ThisDocument instead.

    Hmmm. Ok. I'll switch. Thanks.

Posting Permissions

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