• Macro prob (Word97)

    Author
    Topic
    #362182

    Hi,

    When we send Word documents thru mail will that word document contain macros created by me.
    If not how can i send them along with word document.
    Let us know if any MS article is there related to attaching macro to a word document

    Thanx

    Viewing 3 reply threads
    Author
    Replies
    • #549392

      If the macros are placed in a module attached the document in question, then they should go with th edocument.

      If you are recording the macros, you should see an option to as to where to store the macro. There is a dropdown list titled Store Macro in :, and you can select the document from there.

      If you are typing in the macros yourself, just make sure that you insert a module into the project (Documnet) that you are working on, and compose the macros in that module.

      Hope that is clear.

      Andrew

      • #549395

        Please let us know if u have detailed steps to do this.
        bye & regs

        • #549396

          Could you say which method you want detailed steps for –

          1. Recording the macros or

          2. Typing them in the VB editor yourself.

          Andrew C

          • #549400

            Hi Andrew,

            We have no issues with macros creation/using we are not able to send them along with doc files. We were wondering whether word *.doc files will have macros embedded along with the documents.

            • #549403

              If the macros are in a module of the Document in question they will be emailed with the document. If you are having problems, it could be MerC suggested that your recipients may have the security settings to high, where macros are not run.

              I am not sure exactly what steps to assist you with.

            • #549405

              Hi Andrew ,
              I didnt understand the meaning of “module of the Document” for that i asked a sample step to create a sample.
              bye & regs

            • #549412

              If you are creating a macro from the VB editor (Alt F11), you will notice that there is a Window on the left known as the Project explorer. It should contain an item for each project (document) that is open at the time. You should see Normal for example, which represents Normal.dot. You should also see a reference to the document you are working on, For example Project(Document1). If you select that, the go Insert, Module you should have a module attached to that document. You can them placed your macro in that module, and it should go whereever the document goes.

              Does that help ?

              Andrew C

            • #549416

              Hi Andrew,

              Thanx a lot for that, Now i got it

              Thanx again
              Bye

    • #549393

      Hi
      You don’t ‘attach’ macros – they’re embedded. At least they are in Office 2000 – it’s too long ago for me to remember what happens in Office 97.
      Unfortunately, sending them by email is a way of spreading viruses inadvertently, and many people disable them running on their system. I would suggest you find some other way of doing what you are trying to do; either that or upload your docs to an On-Line Storage site, where your clients can get at them. They still may have Office macros disabled, though.

      Rgds

      • #549397

        Hi,
        Please let me know if u send/copy document files ie (*.doc) files to a different system will they contain macros created in the system where i edited the doc file.

    • #549475

      Hi,

      You probably have asked a bigger question than you intended. When you email a document it will contain all macros that are stored in the document. Usually there are no macros stored in the document.

      Macros are stored in:
      1) normal.dot
      2) the attached template, and/or
      3) the document

      Normal.dot can be the attached template but doesn’t have to be. Macros can also be stored in global templates other than normal.dot but that takes special work to do.

      The default storage place for macros is in normal.dot but when you record a macro you can tell Word to put it in either the attached template or the document instead. This is done at the same time the macro is named.

      Macros (or procedures) are visual basic for applications programs that are stored in modules. When you record a macro, it will be stored in a module called “NewMacros.” If you record multiple macros, they will all be stored in this module. You can have a “NewMacros” module in your document and in your attached template and in normal.dot.

      Macros are given names when you record them or if you write them yourself in visual basic. The default name is some variant of “macro1.” There should be only one macro with a given name in a document or template but you can have three different macros with the same name in the document, its attached template, and normal.dot. If you do, the one in the document will be used in preference to the one in the attached template which will be prefered to the one in normal.dot.

      You can use a dialog box called the Organizer to copy macro modules (but not individual macros) from one template or document to another. You can get to this with Tools => Macros… =>Organizer (button). Click on the tab that has the word “macro” in it.

      To copy a macro module, open the document in which you want the macro to reside. Use the Organizer to copy the whole module. Your document will show up in the left-hand window and normal.dot will show up in the right-hand window. If the module is anywhere other than in normal.dot, click on the “Close” button under the normal.dot window and then click on “Open” and open up the template or document containing the macro module you want to copy. Select the module and click on the Copy button. If you already have a module with the same name in your document you will need to rename it first. Once you have copied the module, click on the Close button to return to the document. If the module contained only the macro that you want and you did not have to rename a module, you are done. Save and close your document.

      If you have multiple macros in a module and you only want to copy one, you need to use the visual basic editor to do the copying. If you renamed a module so you could copy one with the same name into your document, you’ll need to use the editor as well.

      To open the VBA editor, with your document open, press Alt-F11. Find your module and double-click on it to open it for editing. If there are a lot of macros in your module, you can use the F3 (search) function to find the one you want, search for the name.

      A recorded macro named “MyMacro” in the visual basic editor will start with “Sub MyMacro ()” and end with a separate line that says “End Sub.” The following is a recorded macro that types the words “This is a test macro.”

      Sub MyMacro()
      '
      ' MyMacro Macro
      ' Macro recorded 10/31/01 by Charles K. Kenyon
      ' "&chr(10)&"Sample macro to show syntax of recorded macro.
      '
          Selection.TypeText Text:="This is a test macro."
      End Sub
      

      The parts of the macro that have a single apostrophe before them are comments. In this case, all of the comments were inserted by the macro recorder. I typed the information about the purpose of the macro into the description window before recording it. The key thing is that you want everything between (and including) “Sub” and “End Sub.”

      If your module has other macros you don’t want to share, delete them. If you renamed a module to allow you to copy this module into your document, open up the renamed module and copy all the contents of the renamed module back into the “NewMacros” module. Right click on the name of the renamed module and select “Remove.” You do not want to export before removing. You probably don’t have to copy these and remove the renamed module, but if you used any of the macros in your renamed “NewMacros” module for custom buttons on a toolbar or assigned keys to them, Word won’t be able to find them unless they are in the “NewMacros” module. Better safe than puzzled later on.

      ———–
      Although documents can contain macros, they are seldom the right place for them. A macro implies a dynamic, changing item. Normally a template is a better holder for such content because when a template is used as designed it will create a new document (based on the template) with access to all the resources like macros that are in the template.

      You may want to take a look at (addbalance.com/usersguide/templates.htm) for information on the different kinds of templates, where they are stored, and how to get them to show up under the File => New dialog. You may want to look at Sharing Customizations for instructions and information on sharing / copying / moving customizations including macros, AutoText, toolbars and key assignments.

      Hope this helps clarify the situation for you.

    • #549778

      While on the subject of macros/templates I have found that if a custom template is used to generate a document and that document is subsequently assigned macros and then e-mailed or placed on an intranet the macros will fail because the end user will not have the custom template.

      After generating the doc and adding macros I remove the attachement to the custom template. This forces the doc to use the normal.dot wherever it is opened.

    Viewing 3 reply threads
    Reply To: Macro prob (Word97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: