View Single Post
 
Old 07-15-2023, 10:10 PM
ksor ksor is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Feb 2018
Location: Århus V, Denmark
Posts: 78
ksor is on a distinguished road
Default "Security center" NOT working or messed up !!!

I have an Access application creating some Word documents.


I want these documents (created via my Access application) based on a special template - let's call it "AccWrdTemplate.dotm".


I have the template stored side by side the Normal.dotm in the folder "C:\Users\kelds\AppData\Roaming\Microsoft\Template s"


It works nicely when I use the Normal.dotm template but NOT when I use AccWrdTemplate.dotm - macros is blocked ... in fact my special template is just to a start a COPY of the Normal.dotm !


Why is the FILE NAME so cardinal here - that's the ONLY difference !

Here are the code I use:


Code:
        Set WRDobj = CreateObject("Word.Application")
'        WRDobj.Visible = False
        Set Doc = WRDobj.Documents.add(Environ("SlgtSysWordSkabelon"))
        Doc.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "NotatID: " & Me.NotatID.Value & "-" & Me.Benævnelse.Value
        Doc.SaveAs Environ("SlægtHovedmappe") & "\" & "NOTAT_docs\" & Me.Sti_til_fil.Text, wdFormatDocumentDefault
        WRDobj.Quit
        Set Doc = Nothing
        Set WRDobj = Nothing
What the Heck is wrong with this "Security Center" ... I can see others have lots of problems too !

Maybe I should say that the 'shift' from Normal.dotm to AccWrdTemplate.dotm is done by changing the enviroment variable "SlgtSysWordSkabelon" - so

no code is changed
no storage is changed
ONLY the file name is changing - Normal.dotm is OK, but AccWrdTemplate.dotm is NOT - it block for macros !


If I 2-click the dotm file it works nicely in BOTH cases - no warning of blocked macros !!!


Now comes the FUN PART: If I store my special template in a special folder AND give it the file name Normal.dotm ... then NO warning of blocked macros comes up !
OH, NO ... something else fooled me here !


HALLOOOOO MS people if you are here - do something about this problem or tell me what I do wrong !!

Last edited by ksor; 07-16-2023 at 03:28 AM.
Reply With Quote