Ik heb een prima werkend userform maar ik moet meer inforrmatie daarop kwijt, dus wil graag nadat ik op de button ok heb geklikt naar het tweede userform gaan waarop ik deze info kwijt kan.
Nadat ik op het tweede userform heb geklik mag pas de data in het wordformulier worden ingevoerd:
wie weet hoe dat moet? of weet de goede site op het internet?
code in VSB tot nu toe:
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) = "CDEV Computing LETTER 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
Nadat ik op het tweede userform heb geklik mag pas de data in het wordformulier worden ingevoerd:
wie weet hoe dat moet? of weet de goede site op het internet?
code in VSB tot nu toe:
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) = "CDEV Computing LETTER 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