locked
cannot get the style formatting to work RRS feed

  • Question

  • Hi,

    I have a question regarding styles formatting in word. I have two documents templates called templateA and templateB. In templateA, I created a style called myStyle with a specific numbering and bullets as follows

    Section 1.

    - with 1 is automatic numbering

    Then, I created an autotext for it.

    Now, I have also created the same style with the same name in templateB with the same numbering formatting as templateA.

    I want to insert this Section from templateA into templateB document via the following macro

     ActiveDocument.AttachedTemplate.AutoTextEntries("mySection").Insert _
        Where:=Selection.Range, RichText:=True

    Strangely, it appears as if they were not of the same style in a sense that I got two Sections with the same numbering.

    For example,

    After inserting the Section 1 into templateB document, I want to add more Sections. Instead of getting Section 2, it repeats Section 1 again.

    I was wondering whether or not this is to do with the nature of the code in the macro above. Are there any solutions to this?

    Any help would be very appreciated.

    Thank you

     

     

     

    Tuesday, November 23, 2010 1:20 AM

All replies

  • Hello,

    I'm not seeing this issue on my machine.  It displays "Section 2" when I insert the autotext entry, so we might need to get more information about what you are trying to accomplish.

    I do have a couple follow up questions. 

    1. What version of Word are you using? 
    2. I'm confused about why you need to do anything with Template A and B, when the style is exactly the same.  Is there a particular reason why you need to use the same style for two different templates?
    3. When you say template document, do you mean ".dot" or ".doc"?

    Brandon

    Wednesday, November 24, 2010 10:43 PM
  • Thanks Brandon for your reply.

    1. Yes, I agree with you. It works really well with my old word 2003.

    But because I have got a new laptop installed with Windows 7 as well as the new office 2010 installed. And it stop working now with Word 2010. It drives me mad. I don't understand why it works on the older version but not on the newer version 2010.

    2. There is a reason why I use the same style with Template A and B. I have a template (in this case, template B) that would help users to create a report document with the style formatting we want according to our company standard report policy. In the template B, I have macros that enables user to create as many sections as they need to. So to do that, I have another template made up (in this case, template A) that has only one Section in the body with the right style formatting. I then inserted it into AutoText.

    So when user want to add more sections in a document based on template B, he can click a macro button "Add Section" to add another Sections in the report. To do that, I use the code I previously described in my earlier post to insert the AutoText entries.

    3. It is .dot when I say template document.

    Hope the above information would help you to help me as to why it does not work with the latest word 2010. And maybe there is another workaround to this issue.

    Thank you in advance

     

     

    Thursday, November 25, 2010 12:57 AM
  • Sorry about the confusion, but I meant I don't see the issue on my Word 2010 machine.  I might not be using the same steps that you are, so that might be why we are seeing different behavior.  I created a template that has code to open another template and insert an autotext entry and I don't see the problem on Word 2010.

    Can you put the Section text that is formatted with the right style in template B as an AutoText entry rather than use macro code to go out to Template A to get it?  I'm not sure what your workflow is like, but I'm still confused about the need to have 2 different templates.

    Brandon

    Thursday, December 16, 2010 12:37 AM
  • You may need to contact paid support and they can help provide a more in-depth level of support.  Please visit the below link to see the various paid support options that are available to better meet your needs.

    http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone

    Brandon

    Friday, December 31, 2010 8:40 PM