Results 1 to 13 of 13
  1. #1
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't see macros within modules

    I'm having difficulty seeing the individual macros within a module, after copying to a new template. Here's what happened.

    I have a global template called macros.dot which contains 1 module called NewMacros containing about 20 macros. I used the Organizer to copy the module to a new template.

    First problem: I closed & reopened Word, opened dot1.dot, & pressed Alt+F8 to see the macros. None showed up; and I did change the "macros in" from all active templates to dot1.dot.

    Second problem: I went to the Organizer & verified that NewMacros was indeed in dot1.dot. I opened the VBE & verified that there was a module called NewMacros. However, I couldn't access the individual macros on the right side of the VBE. I closed Word, removed macros.dot, & restarted. I opened both dot1.dot & a new document based on it. I could not view the template project. Am I correct that to access the macros within the module of a non-global template, the template must be open AND not loaded?

    Third problem: Regardless of whether I remove macros.dot as a global template, & regardless of the combination of opening dot1.dot & loading or not loading it, I cannot access ANY of it's macros through the customize dialog box! That means that I can't create a toolbars to access these macros in the template.

    I should also point out that I was having trouble getting dot1.dot to stick in the MRU list. I have recently deleted & rebuilt my Data key in the registry to correct that problem.

    I was finally able to copy 2 macro buttons (that I had put on a standard toolbar (1 in normal.dot & 1 in macros.dot) to a custom toolbar in my new template & have it work. It's accessing the macros in dot1.dot b/c nothing else is loaded. But I still can't edit NewMacros. And it won't stay in the MRU list. After deleting the last 2 MRU entries from the list, & opening dot1.dot, now all the macros are listed under Tools/Customize/Macros. Still not listed under Alt+F8.

    Basically, I'm trying to find out what I've done wrong so that I can access these macros in dot1.dot through the customize dialog box & through Tools/Macro/Macros...OR if I'm still having a corruption problem.

    Thanks in advance for any assistance.

  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: Can't see macros within modules

    I HATE having to make this sort of question to someone like you. Only that I've made these mistakes permits me to ask ....


    1) These procedures aren't Functions, are they?
    2) OK, so they are Subs; they don't have parameters, do they?
    3) OK. Subs-without-parameters. Are you/were you able to see them with Alt-F8 at any time in the past?

  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: Can't see macros within modules

    The behaviour you describe is so uncharacteristic of a properly functioning Word session that I'm templated to say your Normal is hosed.

    Why should you not be able to see procedure names?

    What happens when you Alt-F11 to the IDE. What do you see for the template project?
    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
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't see macros within modules

    Hi Chris:

    Thanks for responding. I don't feel the least bit bad, so neither should you. My knowledge lies elsewhere. When it comes to macros, etc. & programming, I'm a novice.

    All these "macros" are:
    Sub SomeName()
    something in here
    End Sub

    All of them started as macros that I've either recorded, pasted from somewhere, or created. I put them all in a blank template, named it "macros.dot", & put it in the Word startup folder. When I open macros.dot, whether or not it's loaded, I can see all my macros either in the VBE, or by pressing Alt+F8 under "all active templates...".

    However, I'm trying to test a few things by making a copying toolbars, etc.. So my first step was to copy the entire module, "NewMacros" into a new template. So far, that's all I've done. I could & can see them with Alt+F8, when macros.dot is running, but not when I look in dot1.dot (my new template).

    Thanks for taking the time to look at this.

  5. #5
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't see macros within modules

    Hi Kevin:

    See my post to Chris. Normal.dot seems fine & it makes no difference if I rename it & create another. The template project says dot1 & the module name is NewMacros. I can see all the macros in the VBE at present.

    Thanks,

  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: Can't see macros within modules

    Execute Plan "B".

    Backup/copy your system.dat and user.dat (you do that automatically each morning, don't you!) and then use RegEdit.EXE to go to HKey-currentUser, software, microsoft, office, 8.0, word, data.

    Right-click on the yellow folder "data" and delete it. Re-load word.

    As time goes by I'm seeing more and more fixes result from deleting this coded little item. may not work for you, but it cures a runny nose for me.

    I'm Win95/Word97/SR2.

  7. #7
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't see macros within modules

    Hi Phil,

    My understanding is that you cannot copy a module to a template if it already has a module of the same name. If I recall correctly, it doesn't warns you at all, either. Every project has the NewMacros module (hence your troubles).

    So, Plan C is to either rename the NewMacros module in the source template before copying, rename or delete the NewMacros module in the destination template, or copy the code from the source template and paste into the NewMacros module of the destination template.

    HTH,

    Chris

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't see macros within modules

    Hi Chris:

    Deleting the Data key (I did this a couple of days ago anyhow) didn't help.

    I then took my macros.dot template & another global template out of Startup. I started Word, opened dot1.dot, containing my module "NewMacros". The results are:

    1. When I go to Tools//Organizer/Macro tab, I see the module "NewMacros" as I should.
    2. When I Alt+F11, I see the module listed on the left & ALL macros listed in the right pane.
    3. However, when I press Alt+F8 & change "Macros in:" to dot1.dot, I see nothing. This is true whether or not I load my macros.dot
    4. This is strange, though. With dot1.dot open, when I go to Tools/Customize & make sure the "Save in" box says dot1.dot:

    A. If I don't have macros.dot loaded, I do not see my macros.

    B. If I do have macros.dot loaded, I do see my macros.

    Whether I have macros.dot as a global template only seems to affect what I see in the Tools/Customize dialog box; it doesn't affect what I see in the VBE.

    What should I be getting?

    Thanks again.

  9. #9
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't see macros within modules

    Hi Chris:

    Well, when I created dot1.dot, I started with no macros at all. Normal.dot, which I based dot1.dot on, doesn't have any modules at all listed in the VBE.

    Plus, I actually see the macros listed in the right pane of the VBE when I have dot1.dot open. I will try your suggestion & delete the module in the destination template & do it again, but I still can't figure out what's happening.

    I just created a brand new template (no macros at all). In the customize dialog box, I still see all the macros that are loaded from other templates.

    Am I correct that you should see ALL macros in global or open templates in the customize dialog box?? If so, then that means that I'm not seeing my macros from dot1.dot in the customize box.

    O.K. I'm thoroughly confused, but I think you hit the problem. I just went through similar steps from scratch.

    1. I created a new template (by now, dot4.dot).

    2. When I tried to copy the "NewMacros" module from Macros.dot through the Organizer, I couldn't...no module showed up in Macros.dot. Macros.dot had been loaded in the startup folder.

    3. I unloaded Macros.dot & I could then copy the module, "NewMacros" to dot4.dot & I immediately renamed it "TestMacros".

    Now, everything shows up as it should (Organizer, VBE, Alt+F8, & customize dialog box).

    I'm still puzzled. It seems that if there are two modules containing identically named macros in two different templates, Word can only show one. I don't understand that because the path IS different. I also don't understand why my previous template wasn't working with Alt+F8, even after I unloaded the macros.dot.

    Any insight would be appreciated!

    Thanks again.

  10. #10
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Oregon, USA
    Posts
    129
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't see macros within modules

    Hi Phil,

    I can't explain *all* of the behavior of the VBE and what displays in the macros list. I can say, "Welcome to SDI."

    I remember in Word 97 that, if you had two routines with the same name in different templates, neither displayed in the list when you had "All Active Documents and Templates" selected.

    In Word 2000, "All Active Documents and Templates" actually means "This document or template, Normal.dot, and all add-ins." Which frustrates me no end, because I have to have a document based on the template activated to test code (but that's another rant). That means if you have two routines with the same name, the routine displays in the list *for the active template.*

    So,when you say, "I'm still puzzled. It seems that if there are two modules containing identically named macros in two different templates, Word can only show one," that isn't because the macros are named the same, its because of the "new" meaning for "All active documents and templates."

    It's kind of like the "Styles in use" setting on the format styles dialog that actually means, "Styles that have ever been in use even if they no longer are." It precisely describes the *almost* right thing. :-)

    That said, I'm hoping you're running Word 2000 because, if not, this response is senseless. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    HTH,

    Chris

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't see macros within modules

    Hi Chris:

    Thanks for the explanation & "yes", I'm running Word 2000. Of course, even when I change the macro list from "All active templates & documents" to my specific template, none of the macros showed while the modules were named the same. I'm going to try duplicating the problem & seeing if adding a macro to the "same named" module will show by itself. I need to get a very basic book. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

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

    Re: Can't see macros within modules

    I haven't forgotten you. Just haven't made fifteen minutes to set up the experiment.

  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: Can't see macros within modules

    The attached file holds
    (1) a crude set of experiments with explanations, run in Word97SR2 and
    (2) E X T R E M E L Y shakey text from a never-delivered course. may be helpful.


    In my comments below I have taken liberty in replying to several postings at once to, oh, I don't know. To reduce something or other.

    Also I say "But see .... below". It's probably in the attached document, rather than in this inline posting. By now, of course, Phil has gotten his degree in Theology and has abandoned macro programming as being too esoteric a form of worship ....

    > Am I correct that to access the macros within the module of a non-global template, the template must be open AND not loaded?

    Yes

    >rgardless of the combination of opening dot1.dot & loading or not loading it, I cannot access ANY of it's macros through the customize dialog box! That means that I can't create a toolbars to access these macros in the template.

    [microsoft] If you can't run a macro from where you are, you can't have it on a toolbar from where you are, because if you COULD have it on the toolbar, what's the point, since you can't run it [/microsoft]

    > I was finally able to copy 2 macro buttons (that I had put on a standard toolbar (1 in normal.dot & 1 in macros.dot) to a custom toolbar in my new template & have it work. It's accessing the macros in dot1.dot b/c nothing else is loaded. But I still can't edit NewMacros.

    But see "Traps for young players with toolbars" below

    >The behaviour you describe is so uncharacteristic of a properly functioning Word session that I'm templated to say your Normal is hosed.

    The corrupt MRU list problem is, I believe, associated with the registry data entry and is unrelated to Normal.dot. The problems most likely to be associated with Normal.dot are those of visibility-of-macros, and I'm still struggling to comprehend the Word97 visibility issue, he said, since honesty ought to cost me nothing.



    >What happens when you Alt-F11 to the IDE. What do you see for the template project?

    > he VBE, or by pressing Alt+F8 under "all active templates...".

    I think visibility problems are by design, and that the design is going to make sure that macros are invisible regardless of the means used to gain access to the macros.

    > My understanding is that you cannot copy a module to a template if it already has a module of the same name. If I recall correctly, it doesn't warns you at all, either. Every project has the NewMacros module (hence your troubles).

    Easy to test this. In VBE drag a MewMacros module from one template to another, then drag it back. VBE DOES make the copy and gives it a new name (NewMacros1) but DOESN'T give you an error message. Same behaviour when you File, Import an identically named module from a BAS file.

    Not every project has the MewMacros module. Only those where it has been fabricated automatically (Tools, Macros, Record new macro) or manually by dragging it in as above. Many of us cut our teeth on recorded macros, so we tend to have a lot of NewMacros modules lying around.



    > 3. However, when I press Alt+F8 & change "Macros in:" to dot1.dot, I see nothing. This is true whether or not I load my macros.dot

    Please see my notes below, where I suggest flipping with ctrl-F6 between documents to reduce visibility. I suspect this was happening to you here too.

    > What should I be getting? (in the VBE.)

    In general, expect to see in the VBE ONLY those modules/macros that are NOT in global/Addin projects. I frequently have a template loaded as a global (Under119.dot) and decide to edit a later version (Under120.dot). Both show up as project "Under" in the VBE. I've just noticed that the filename appears in parentheses to the right, thus "Under(Under119)". Double-clicking the global template gets me a warning message, double-clciking the open template gains me access to edit my macros.

    >Am I correct that you should see ALL macros in global or open templates in the customize dialog box?? If so, then that means that I'm not seeing my macros from dot1.dot in the customize box.

    Yes.

    > I'm still puzzled. It seems that if there are two modules containing identically named macros in two different templates, Word can only show one

    > . I don't understand that because the path IS different.

    I think it's not so much a question of two identically-named macros as the names of their modules. Tools, Macro, Macros is geared to show only ONE MACRO name from all macros available. If you have a gazillion Msg1 macros spread around a gazillion global templates, how would Word show them in the Tools, macro, macros list? It can't, so [microsoft] some restrictions apply [/microsoft]. Tools, addIns, Organizer on the other hand uses file names to distinguish between TWO MODULES in separte files. Ah hah! VBE on the third hand, gives you access to each of your gazillion msg1 macros since your gazillion templates are all available for perusal. Except for the global ones.

    Don't get confused between the macros you can see as a runner, the modules you can see as an organiser, and the detail you can see as a programmer.

    > I remember in Word 97 that, if you had two routines with the same name in different templates, neither displayed in the list when you had

    This may be whjat happened to me in "I see only Msg1, not Msg2"

    >It seems that if there are two modules containing identically named macros in two different templates, Word can only show one," that isn't because the macros are named the same, its because of the "new" meaning for "All activedocuments and templates."

    But see "the macros you can see as a runner" above.
    Attached Files Attached Files

Posting Permissions

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