Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-27-2023, 05:19 AM
Ddadoo57 Ddadoo57 is offline how to replace the Model property of a closed document Windows 11 how to replace the Model property of a closed document Office 2021
Advanced Beginner
how to replace the Model property of a closed document
 
Join Date: Feb 2023
Posts: 73
Ddadoo57 is on a distinguished road
Default how to replace the Model property of a closed document

Hello,



Does anyone know how to replace the Model property of a closed document, without opening it, in order to end up with .AttachedTemplate=""?

Many thanks in advance!
Best regards ,
David
Reply With Quote
  #2  
Old 06-27-2023, 05:47 AM
Ddadoo57 Ddadoo57 is offline how to replace the Model property of a closed document Windows 11 how to replace the Model property of a closed document Office 2021
Advanced Beginner
how to replace the Model property of a closed document
 
Join Date: Feb 2023
Posts: 73
Ddadoo57 is on a distinguished road
Default

here's what I currently have, but maybe there's another way ?

Dim doc As Document
Set doc = Documents.Open(fileName:=fileNamePath, Visible:=False)
doc.AttachedTemplate = ""
doc.Close SaveChanges:=True
Reply With Quote
  #3  
Old 06-28-2023, 06:46 PM
Guessed's Avatar
Guessed Guessed is offline how to replace the Model property of a closed document Windows 10 how to replace the Model property of a closed document Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

That is the way I would be doing it. I don't believe you can modify the attached template setting without opening the file.

It may be possible to modify one of the xml files within the zipped docx file format but that is effectively 'opening' the file if you are going to save it anyway.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to recover the advanced properties of a closed document? Ddadoo57 Word VBA 5 03-20-2023 01:46 PM
Find and replace all the text flagged with the 'wdDeletedTextMarkStrikeThrough' property alex100 Word VBA 4 08-31-2020 06:02 AM
how to replace the Model property of a closed document Extract Document Property and insert it into the same document, for many files in a folder MisrIdley Word VBA 1 12-07-2017 12:41 PM
Vba code to save document as pdf using document property text and rename folder. staicumihai Word VBA 1 12-21-2015 07:39 AM
how to replace the Model property of a closed document How to save a macro in a document generated with a word model? Cristin7 Word VBA 4 03-25-2014 03:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft