Solved

Insert autotext via a makro

Posted on 2014-11-24
2
93 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 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
Hi,

pls try

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

Regards
0
 

Author Comment

by:mvp1985
Comment Utility
Works great. Thanks a lot
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Like many others, we try and discourage users from printing documents unnecessarily and instead send or share them electronically. However, this doesn't always work and documents are still printed. With this simple solution, if the user tries to …
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

743 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

8 Experts available now in Live!

Get 1:1 Help Now