Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Insert AutoText using Macro from template (2000 SP2)

    I have created a template named firm.dot that is located in the C:Program FilesMicrosoft officeofficestartup folder. In this template, I have one macro for a 2nd page header. This header contains one picture and several lines of text (recipient name, date, and page x of x). The second page header info is currently saved as an autotext entry ( header2 ) in the firm.dot. The macro is supposed to enter the second page header and insert the autotext entry.

    Here's my problem: I can't get the macro to call up the header2 autotext entry from firm.dot. It seems to want to pull it from the normal.dot instead (this is a recorded macro - I don't know how to create them from scratch). Here's what that line of the macro says:
    <hr>NormalTemplate.AutoTextEntries("header2").Inse rt Where:=Selection.Range<hr>
    What should I do to make it look at my firm.dot's autotext instead of my normal.dot's autotext? <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    Thanks,
    Becky

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

    Re: Insert AutoText using Macro from template (2000 SP2)

    Hi Becky:
    Not being a VBA expert, I can't answer your question directly. However, why do you have a separate macro & autotext entry for the second page header? I'm assuming that you want a different first page header. You could simply create a header for your firm.dot, then go to File/Page setup/layout tab & tick the box for first page header. Then create that & save your template. If it's a one page document, you get only the first page & its header. With 2 or more pages, you get everything.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert AutoText using Macro from template (2000 SP2)

    I only have a separate autotext and macro for my second page header because I don't know how to insert the picture (our firm's logo) using a macro. <img src=/S/blush.gif border=0 alt=blush width=15 height=15> I wanted to make it as simple as possible, so I wanted to be able to just hit one button while in a document to add the 2nd page header. I could go into the 2nd page header manually and just insert the autotext, but I wanted to take the oops factor out for the user's sake.

    The firm.dot template is located in every user's startup group, so I don't want this 2nd page header to show up on every document...just on ones the user chooses (it wouldn't be much use on many of our documents). This firm.dot also contains macros to fix a few simple document problems - margins and "funky" documents. Basically, the firm.dot is just a holder for all the nifty gadgets I want the users to be able to access. Whenever I make updates to my firm.dot, we just make the file copy back down to everyone's startup folder using their login script.

    There probably is a better way, but I haven't found it yet. If you know of one, I'd love to hear it! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Thanks,
    Becky

  4. #4
    New Lounger
    Join Date
    Jan 2002
    Location
    Bismarck, North Dakota, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert AutoText using Macro from template (2000 SP2)

    You might try the following:

    Templates("C:Program FilesMicrosoft officeofficestartupfirm.dot").AutoTextEntries("hea der2").Insert Where:=Selection.Range

    I am not an expert but I think I have doing about the same thing with this statement. I have my equivalent of firm.dot loaded as an AddIn and this is the statement that has been working for me.

    Good luck,
    Missy

  5. #5
    New Lounger
    Join Date
    Aug 2001
    Location
    Washington, DC
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert AutoText using Macro from template (2000 SP2)

    You might also need to add ", Rich Text:=True" to the statement below if you need to make sure the entry is formatted the way it was when you created the AutoText.

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

    Re: Insert AutoText using Macro from template (2000 SP2)

    Hi Becky:
    If there are different types of documents that the user creates, you might consider using different templates for each. You can create a header (what you're calling a second page header) in a template & a different first page header. The header will not show up until there is at least 2 pages in a document. However, there's nothing wrong with your approach. It depends how often users will be needing the header (2nd page) vs. having a second page with a blank header.
    Cheers,

  7. #7
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert AutoText using Macro from template (2000 SP2)

    OK, now I have an interesting problem. When I had the firm.dot in the startup folder loaded as an add-in, the macro still wouldn't work. I moved the firm.dot to the templates directory and added it as an add-in, it worked just fine. I'm almost perfectly happy with this, but I have one question. How do I make the firm.dot in the template directory automatically load every time Word is started? I currently have to go to Tools-Templates and Add-ins and check the box.

    Thanks for your help!
    Becky

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

    Re: Insert AutoText using Macro from template (2000 SP2)

    Becky,

    Put your firm.dot in the Word Startup Folder (indicated under the Tools>Options>File Locations tab. Or change the location to point to the firm.dot location.


    As to your original question:

    Try this line instead:

    Thisdocument..AutoTextEntries("header2").Insert Where:=Selection.Range
    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>

  9. #9
    New Lounger
    Join Date
    Jan 2002
    Location
    Bismarck, North Dakota, USA
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert AutoText using Macro from template (2000 SP2)

    Each user's normal template needs an auto execute routine. Go to the visual basic editor and in the normal template add the following to Module1 (or whatever module you have listed):

    Sub AutoExec()
    AddIns("c:...firm.dot").Installed = True 'replace the ... with the full path name
    End Sub

    Hope this helps.
    Missy

  10. #10
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert AutoText using Macro from template (2000 SP2)

    I tried the line you gave me, but it wasn't happy with it (I think the double . made it mad). I did use the line that Missy offered, and it worked fine once I moved the Word Startup Folder to point to my Firm.dot.
    <img src=/S/joy.gif border=0 alt=joy width=23 height=23> <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Here's my only problem now...my Firm.dot is loading twice as an add-in. If I go to Tools-Templates and Add-ins, it's listed twice. I can manually remove the extra one, but it still comes up by default when I open Word. The only problem I have with this is that it lists all of the toolbar buttons from Firm.dot twice - except for my new button. I did a seach for an extra firm.dot on my c: drive, but only one exists. The extra firm.dot listed under add-ins is pointing to a directory I'm pretty sure doesn't exist (I can't tell for sure...it doesn't show the full path). The extra one is pointing to C:...Micros~1officestartupfirm.dot

    Any suggestions?

    Thanks so much for your help!

    Becky

  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: Insert AutoText using Macro from template (2000 SP2)

    Hi Becky:
    It sounds like you have two Firm.dot templates, one in startup & one in the templates folder or one in each of two startup folders. Did you search the entire hard drive with "include subfolders" checked? There ARE two startup folders in Office 2000 by default. One is a Word startup folder & the other is an Office startup folder. The latter, by default, will be at:

    C:Program FilesMicrosoft OfficeOfficeStartup

    You can see this by going to Tools/Options/File Locations/ & clicking Modify. Then you should be able to see the entire path.

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

    Re: Insert AutoText using Macro from template (2000 SP2)

    Well, not really. If the Word startup folder for all users contains firm.dot, the AutoExec macro in that one global template will execute for all users. There's no need (in fact, there are good reasons NOT) to modify user Normal.dot files.
    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>

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

    Re: Insert AutoText using Macro from template (2000 SP2)

    That was a typo. One dot after thisdocument.

    I think Phil's right. You are loading firm.dot twice. Probably once because it's in one of the startup folders and second with a line of code (addin.add etc.) Edit the "one" firm.dot file and remove (or comment out) the line that loads firm.dot as as addin. AND, remove any code from Normal.dot that loads firm.dot as an addin.
    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>

  14. #14
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Insert AutoText using Macro from template (2000 SP2)

    When I use the code you gave me, I get the following error message:

    Compile Error: Method or data member not found.

    It has highlighted the AutoTextEntries portion of the code, so I'm guessing that's the part it doesn't like. I'll just use the Templates... code from Missy and be happy (unless there's a good reason why that's a bad idea).

    I figured out what was causing my buttons to show up twice. I was launching word from Start-Run (Winword) and it somehow loaded the template twice (even though it really did only exist one time - I even tried it on a second machine). When I launched it from a normal shortcut to Word, it only loaded one template. I have no idea why it would do that, but I'm happy it's working anyway!

    Thanks again for all of your help! <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30> <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>

    Becky

  15. #15
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Richmond, Virginia, USA
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Thank you!

    I have no idea why it would do this, but when I launched Word from Start-Run, it automatically launched the firm.dot as an add-in twice. It doesn't do that when you launch it from a shortcut to Winword.exe. We have a document management system, so none of our systems have shortcuts to Word on the desktops or Start menus...I was just launching the program from Start-Run because I didn't feel like making a shortcut manually.

    I even had the same problem on another machine, and I know only one copy of firm.dot could have existed there. Doing a search only pulled up one copy of firm.dot on both machines (and nothing in the OfficeStartup folder), so then I was very confused. When I opened Word using the document management system for the first time, there was only one copy of firm.dot launched. Launching Word from Start-Run still launches firm.dot twice, though. Go figure!
    <img src=/S/igiveup.gif border=0 alt=igiveup width=31 height=23>
    Sorry for making a simple problem so complicated!

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Thanks for the help,
    Becky

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
  •