![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
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 |
|
#2
|
||||
|
||||
|
So why wouldn't you specify a template other than Normal.dotm for this, via Documents.Add?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Tags |
| vba normal.dotm |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Cannot save some changes to normal.dotm template
|
wiganken | Word | 2 | 12-02-2020 03:28 AM |
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 |
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 |
New template/New normal.dotm
|
kenglade | Word | 3 | 12-19-2011 04:00 PM |