Solved

Insert autotext via a makro

Posted on 2014-11-24
2
96 Views
Last Modified: 2014-11-24
I have a makro that unprotects a document, goes to the end of the document, and then reprotects the sheet, wich works great when I specify the text in the makro. However, I want to assign an autotext instead, so here is my try. Could you fix the autotext part, since that is the only thing not working properly:

Thanks a lot

Sub Macro3a()
    Dim aDoc As Document
    Dim strPassword As String
   
    strPassword = ""
    Set aDoc = ActiveDocument
    If aDoc.ProtectionType <> wdNoProtection Then
        aDoc.Unprotect strPassword
    End If
    aDoc.Bookmarks("\EndOfDoc").AutoTextEntries ("Schaetzung 1")
    aDoc.Protect Type:=wdAllowOnlyFormFields, Password:=strPassword
 End Sub
0
Comment
Question by:mvp1985
2 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40463893
Hi,

pls try

        Application.Templates(aDoc.AttachedTemplate.FullName). _
        BuildingBlockEntries("Schaetzung 1").Insert Where:=aDoc.Bookmarks("\EndOfDoc").Range

Regards
0
 

Author Comment

by:mvp1985
ID: 40463902
Works great. Thanks a lot
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now