Page 21 of 21 FirstFirst ... 11192021
Results 201 to 202 of 202

Thread: Appendix Thread 2. ( Codes for other Threads, HTML Tables, etc.)

  1. #201
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,542
    Rep Power
    10
    Some notes for this main forum Thread
    https://eileenslounge.com/viewtopic.php?f=26&t=42984




    https://web.archive.org/web/20071227....com/kb/190235 27 Dec 2007


    WD97: Run Time Error 4366 Using Application.Run Command
    Article ID : 190235
    Last Review : January 23, 2007
    Revision : 1.1
    This article was previously published under Q190235
    SYMPTOMS
    When you run a Visual Basic For Applications macro containing the "Application.Run Macroname:=" command in Microsoft Word or in another Office program to automate Word, you may receive the following error message:
    Run Time error '4366' : Unable to run the specified macro.
    CAUSE
    You have included a template name as part of the Macroname argument string.
    RESOLUTION
    Remove the template name from the Macroname argument.

    WORKAROUND
    To avoid naming conflicts among referenced projects, give your procedures unique names, so that you can call a procedure without specifying a project or module.
    STATUS
    Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
    MORE INFORMATION
    In the online Help, the Run method states that you can use the template name in the Macroname argument string, and then it shows the following examples as valid statements:
    Code:
       Application.Run "Normal.Module1.MAIN"
       Application.Run "MyProject.MyModule.MyProcedure"
       Application.Run "'My Document.doc'!ThisModule.ThisProcedure"
    Visual Basic for Applications assigns names to macros in the following order:
    Code:
    project.module.procedure.
    When Visual Basic for Applications accesses the Microsoft Word Object model, a project can be either a template or document with stored procedures. In Visual Basic for Applications, the Word projects are named in the following manner:

    Normal - all modules stored in the Normal.dot

    TemplateProject - all modules store in the first file in the Startup
    folder (if more than one template is in the startup
    folder, Word uses the one that was copied
    to the folder first and not by the alphabetical
    listing order).

    Project - additional startup templates, the template the open
    file is based on, or an open saved document with a
    module.


    The following illustration describes how Visual Basic for Applications handles Microsoft Word macros of the same name or macros and modules of the same name in different template and document projects that are active.

    In Microsoft Word, if you open a document named MyDoc.doc that is based on the template MyTemp.dot, both documents have a module called "Newmacros" and a macro called "MyMacro." At Startup, a template called "MyStart.dot" loads with the "Normal.dot" global template. Both of these templates have a module called "Newmacros", and there is a macro called "MyMacro" in the module.

    With the three templates and one document active in Microsoft Word, when the "Macro" dialog box appears, you see the following lines of code:
    Code:
       Normal.NewMacros.Mymacro
       Project.NewMacros.Mymacro
       Project1.NewMacros.Mymacro
       TemplateProject.NewMacros.Mymacro
    Open the Visual Basic Editor by pressing ALT+F11. Then press CTRL+R to view the following in Project Explorer:
    Normal(Normal)
    Project(MyTemp)
    Project(MyDoc)
    TemplateProject(MyStart)


    If you want to run the macro in MyStart.dot, write your code as follows:
    Code:
       Application.Run "TemplateProject.NewMacro.macro1"
    - or -
    Code:
       Normal.NewMacros.Mymacro =  Normal.dot
       Project.NewMacros.Mymacro =  MyTemp.dot
       Project1.NewMacros.Mymacro =  MyDoc.doc
    ________________________________________
    APPLIES TO
    • Microsoft Word 97 Standard Edition
    Keywords: kbbug kbpending kbprb KB190235









    https://web.archive.org/web/20090521....com/kb/190235 May 21 2009




    Article ID: 190235 - Last Review: January 23, 2007 - Revision: 1.1
    WD97: Run Time Error 4366 Using Application.Run Command
    Retired KB Content Disclaimer
    .

    This article was previously published under Q190235
    SYMPTOMS
    When you run a Visual Basic For Applications macro containing the "Application.Run Macroname:=" command in Microsoft Word or in another Office program to automate Word, you may receive the following error message:
    Run Time error '4366' : Unable to run the specified macro.

    CAUSE
    You have included a template name as part of the Macroname argument string.

    RESOLUTION
    Remove the template name from the Macroname argument.

    WORKAROUND
    To avoid naming conflicts among referenced projects, give your procedures unique names, so that you can call a procedure without specifying a project or module.

    STATUS
    Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

    MORE INFORMATION
    In the online Help, the Run method states that you can use the template name in the Macroname argument string, and then it shows the following examples as valid statements:
    Code:
       Application.Run "Normal.Module1.MAIN"
       Application.Run "MyProject.MyModule.MyProcedure"
       Application.Run "'My Document.doc'!ThisModule.ThisProcedure"
    Visual Basic for Applications assigns names to macros in the following order:
    project.module.procedure.

    When Visual Basic for Applications accesses the Microsoft Word Object model, a project can be either a template or document with stored procedures. In Visual Basic for Applications, the Word projects are named in the following manner:

    Normal - all modules stored in the Normal.dot

    TemplateProject - all modules store in the first file in the Startup
    folder (if more than one template is in the startup
    folder, Word uses the one that was copied
    to the folder first and not by the alphabetical
    listing order).

    Project - additional startup templates, the template the open
    file is based on, or an open saved document with a
    module.

    The following illustration describes how Visual Basic for Applications handles Microsoft Word macros of the same name or macros and modules of the same name in different template and document projects that are active.

    In Microsoft Word, if you open a document named MyDoc.doc that is based on the template MyTemp.dot, both documents have a module called "Newmacros" and a macro called "MyMacro." At Startup, a template called "MyStart.dot" loads with the "Normal.dot" global template. Both of these templates have a module called "Newmacros", and there is a macro called "MyMacro" in the module.

    With the three templates and one document active in Microsoft Word, when the "Macro" dialog box appears, you see the following lines of code:
    Code:
       Normal.NewMacros.Mymacro
       Project.NewMacros.Mymacro
       Project1.NewMacros.Mymacro
       TemplateProject.NewMacros.Mymacro
    Open the Visual Basic Editor by pressing ALT+F11. Then press CTRL+R to view the following in Project Explorer:

    Normal(Normal)
    Project(MyTemp)
    Project(MyDoc)
    TemplateProject(MyStart)


    If you want to run the macro in MyStart.dot, write your code as follows:
    Code:
       Application.Run "TemplateProject.NewMacro.macro1"
    - or -
    Code:
       Normal.NewMacros.Mymacro =  Normal.dot
       Project.NewMacros.Mymacro =  MyTemp.dot
       Project1.NewMacros.Mymacro =  MyDoc.doc

    ________________________________________
    APPLIES TO
    • Microsoft Word 97 Standard Edition

    Keywords: kbbug kbpending kbprb KB190235

    Retired KB Content Disclaimer
    This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
    Last edited by DocAElstein; 05-20-2026 at 05:19 PM.

  2. #202
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,542
    Rep Power
    10
    Some notes related to this main forum post
    https://eileenslounge.com/viewtopic....333118#p333118




    We do have some small issues remaining.
    I re checked the features discussed in detail below, always taking care to close completely WORD, in between experiments.

    Here is a TLDR summary, (assumes prior knowledge/ certain awareness/knowledge level etc.):

    _1 dot File in STARTUP
    _1a) Open it and you can mess with its macros. You don't get a new file made from it.
    _1b) Make a new one and you can't mess with its macros, but do get a new file made from it

    _2 dot File on Desktop
    _2a) Open it and you can mess with its macros. You don't get a new file made from it.
    _2b) Make a new one and you can mess with its macros, and I do get new file made from it

    See the difference?

    ( _a) Open means: start with a new virgin WORD, use the file open navigate way
    _ or : right click on the file in explorer and try to find an open option
    _b) New means: By default settings, double clicking on the file in explorer
    _ or : right click on the file in explorer and try to find an new option )

    _.____

    More detailed Experiment Explanation

    Experiment 1 ( dot File in STARTUP ), - A dotm file at STARTUP.dotm in STARTUP folder
    (No word open)

    In my STARTUP is file is
    A dotm file at STARTUP.dotm
    , and not much else going on
    https://i.postimg.cc/qRKRSn8V/dotm-file-in-STARTUP.jpg




    _1a) I either
    take the right click open option (whilst it is in the STARTUP folder)
    , or ( after re closing all Word ),
    Open a fresh WORD, navigate to the STARTUP folder and open the file A dotm file at STARTUP.dotm
    https://i.postimg.cc/vZH5kQ3Z/Open-t...fresh-WORD.jpg
    As expected, I can mess with the macros in the template, A dotm file at STARTUP.dotm , and I do not get a new file "made from" that template
    https://i.postimg.cc/0ys8ZfdX/I-have...ile-made-f.jpg



    Close all word

    _1b) I either
    take the right click new option (whilst it is in the STARTUP folder)
    , or ( after re closing all Word ),
    double click on it, (whilst it is in the STARTUP folder)

    The result is the same. The action appears to be loading the
    A dotm file at STARTUP.dotm
    , and giving me a new file "made from" the template, A dotm file at STARTUP.dotm
    https://i.postimg.cc/VNpvK4bc/New-or...-teemplate.jpg
    As expected, I can't mess with the macros in the template, A dotm file at STARTUP.dotm
    https://i.postimg.cc/d1C1pd8M/dotm-f...New-option.jpg




    So far so good. We are in line with ….. _ Double-clicking a Word template (*.dotx , *.dotm …. ( *.dot) … ) will perform the default action for templates: create a new document based on that template. It will not open the template, but load it (since the new document is linked to the template).
    _ Opening a template file is a different action; it opens it as if it were a document.



    No issues


    _.________________________________________________ ______________________


    Change the situation to the file , A dotm file at STARTUP.dotm , moved to the desktop
    https://i.postimg.cc/ZY1hRR1P/dotm-file-on-Desktop.jpg
    https://i.postimg.cc/7Ppy66p2/dotm-file-on-Desktop.jpg
    ( I know, the file name is a bit inappropriate now. When I get paid later to do my MS Office memoirs, I will do it all a bit more neatly )

    Now we repeat the last stuff


    Experiment 2 (dot File on Desktop ), - A dotm file at STARTUP.dotm on the desktop
    (No word open)

    _2b) I either
    take the right click new option (whilst it is on the Desktop )
    , or ( after re closing all Word ),
    double click on it, (whilst it is on the Desktop folder)

    The result is the same, possibly unexpected . The action appears to be opening the
    A dotm file at STARTUP.dotm
    , but / and, possibly expected, giving me a new file "made from" the template, A dotm file at STARTUP.dotm
    https://i.postimg.cc/6q3WrmBh/have-a...e-template.jpg
    As, also possibly unexpected , I can mess with the macros in the template, A dotm file at STARTUP.dotm
    https://i.postimg.cc/bJrHKqgs/I-can-...e-template.jpg

    Close all word

    _2a) I either
    take the right click open option (whilst it is in the STARTUP folder)
    , or ( after re closing all Word ),
    Open a fresh WORD, navigate to the STARTUP folder and open the file A dotm file at STARTUP.dotm
    https://i.postimg.cc/vZH5kQ3Z/Open-t...fresh-WORD.jpg
    As expected, I can mess with the macros in the template, A dotm file at STARTUP.dotm , and I do not get a new file "made from" that template
    https://i.postimg.cc/Z5K62TV9/No-fil...late-macos.jpg
    Last edited by DocAElstein; 05-22-2026 at 01:09 PM.

Similar Threads

  1. VBA to Reply All To Latest Email Thread
    By pkearney10 in forum Outlook Help
    Replies: 11
    Last Post: 12-22-2020, 11:15 PM
  2. Appendix Thread. Diet Protokol Coding Adaptions
    By DocAElstein in forum Test Area
    Replies: 6
    Last Post: 09-05-2019, 10:45 AM
  3. Replies: 19
    Last Post: 04-20-2019, 02:38 PM
  4. Search List of my codes
    By PcMax in forum Excel Help
    Replies: 6
    Last Post: 08-03-2014, 08:38 AM

Posting Permissions

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