Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2022, 08:05 AM
DDouma1964's Avatar
DDouma1964 DDouma1964 is offline Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? Windows 10 Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? Office 2021
Novice
Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA?
 
Join Date: Aug 2022
Posts: 1
DDouma1964 is on a distinguished road
Default Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA?

In WORD I have created a form with several checkboxes. Each checkbox is linked to a document. By linking a VBA code to these boxes, I generate a new WORD document in which the selected documents are imported.
Below is an example of part of the code:




Private Sub CheckboxAAN_Click()
'code voor het aanvinken van alle checkboxen
VoorbladEnInhoudsopgave.Value = True
Voorwoord.Value = True
Inleiding.Value = True
Beschrijving.Value = True
Veiligheid.Value = True
Transport.Value = True
Installatie.Value = True
Bediening.Value = True
Onderhoud.Value = True
Storingen.Value = True
DemontageEnAfdanken.Value = True
LijstAfbeeldingen.Value = True
LijstTabellen.Value = True
Bijlage.Value = True



Private Sub Publiceer_Click()
'code voor maken van nieuw WORD document
Dim rng As Range
Dim MainDoc As Document
Dim strFile As String
Const strFolder = "C:Users\Username\Location\02_Modulaire opbouw"
Set MainDoc = Documents.Add

'code om document samen te stellen
If VoorbladEnInhoudsopgave.Value = True Then
Selection.InsertFile FileName:=("C:\Users\Username\Location\Voorblad en Inhoudsopgave.docx"), Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak
End If

If Voorwoord.Value = True Then
Selection.InsertFile FileName:=("C:\Users\Username\Location\01_Voorwoor d.docx"), Range:="", _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak
End If

End Sub
Reply With Quote
  #2  
Old 08-17-2022, 08:18 AM
macropod's Avatar
macropod macropod is offline Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? Windows 10 Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

So why wouldn't you specify a template other than Normal.dotm for this, via Documents.Add?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
vba normal.dotm



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? Cannot save some changes to normal.dotm template wiganken Word 2 12-02-2020 03:28 AM
Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? Merge using software that uses MS Word-doc & normal template set to arial, generates in calibri! StephB Mail Merge 2 01-13-2020 04:10 AM
"Changes have been made that affect the global template, Normal.dotm. ..." DBlomgren Word 11 12-18-2017 12:54 PM
Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? Documents hung up, Word won't close due to "Changes made..to global template Normal.dotm" pagskg Word 2 07-23-2014 12:54 PM
Is it possible to choose another NORMAL.DOTM in WORD as template for merge documents using VBA? New template/New normal.dotm kenglade Word 3 12-19-2011 04:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:12 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