Ik ben bezig om in een word template een tweede userform in te bouwen die aangeroepen moet worden nadat het eerste is ingevuld, ik dacht dat na regel 30 een goto die verwijst naar de module gaat werken , maar dit gaat niet goed.Helaas kan ik op het www niet iest vinden wat mij weer op het juist spoor zet zodat we verder kunnen knutselen.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
| Option Explicit
'#####################################################################
Private Sub UserForm_Initialize()
'#####################################################################
'
' Initialise the form
'
' We can preset the form with certain values.
'
' get the 'from' data from the registry
'
tbeigenaar.Text = GetSetting("webhaas", "briefsjabloon", "eigenaar")
'
' set the date
'
tbDate.Text = Format(Date, "d mmmm yyyy")
'
'
' Initialise the Delivery list
'
cbbetreft.AddItem "Offerte"
cbbetreft.AddItem "Aanbieding"
cbbetreft.AddItem "Mailing"
cbbetreft.AddItem "Bevestiging"
End Sub
'#####################################################################
Private Sub cmdOK_Click()
'#####################################################################
'
' The OK button has been pressed
'
' now lets get the data from the form and put it into the letter
'
' Set the bookmark text property to the data from the form
' - here's how...
ActiveDocument.Bookmarks("referentie").Range.Text = tbreferentie.Text
ActiveDocument.Bookmarks("Date").Range.Text = tbDate.Text
ActiveDocument.Bookmarks("naam").Range.Text = tbnaam.Text
ActiveDocument.Bookmarks("bedrijf").Range.Text = tbbedrijf.Text
ActiveDocument.Bookmarks("straat").Range.Text = tbstraat.Text
ActiveDocument.Bookmarks("huisnummer").Range.Text = tbhuisnummer.Text
ActiveDocument.Bookmarks("postcode").Range.Text = tbpostcode.Text
ActiveDocument.Bookmarks("woonplaats").Range.Text = tbwoonplaats.Text
ActiveDocument.Bookmarks("betreft").Range.Text = cbbetreft.Text
ActiveDocument.Bookmarks("onderwerp").Range.Text = tbonderwerp.Text
ActiveDocument.Bookmarks("aanhef").Range.Text = "Geachte " + tbnaam.Text + ","
ActiveDocument.Bookmarks("mvg").Range.Text = "Met vriendelijke groet"
Selection.GoTo What:=wdGoToBookmark, Name:="Closing"
'
' Check the 'value' of the option button to know which is selected
'
ActiveDocument.Bookmarks("eigenaar").Range.Text = tbeigenaar.Text
'
' remember 'from' for next time
'
SaveSetting "webhaas", "briefsjabloon", "eigenaar", tbeigenaar.Text
'---------------set the document properties -----------------------------
ActiveDocument.BuiltInDocumentProperties(wdPropertySubject) = tbonderwerp.Text
ActiveDocument.BuiltInDocumentProperties(wdPropertyCategory) = "Letter"
ActiveDocument.BuiltInDocumentProperties(wdPropertyKeywords) = "webhaas Our Ref: " + tbreferentie.Text
' lets maximise the document on the screen
ActiveWindow.View.Type = wdPageView
ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitBestFit
' lets take the user to the start point so they can start typing
Selection.GoTo What:=wdGoToBookmark, Name:="text"
'
' unload (hide) the form
'
Unload Me
' THATS IT!
End Sub
'#####################################################################
Private Sub cmdCancel_Click()
'#####################################################################
'
' unload (hide) the form
'
Unload Me
End Sub |