﻿ ' Hinweis
 ' Praefix zur Bezeichnung der Dialogfelder:
 ' edt = EditBox, cbo = ComboBox, lst = ListBox, drp =DropDown, chk = CheckBox, grp = GroupBox, opt = Option-(Radio-)Button, psh = PushButton


Sub DatumFortschreiben	

	Begin Dialog FRISTSETZUNG 147,54, 204, 92, "Fristsetzung                                                                             TEST"
  		OKButton 108,68,68,12
  		TextBox 16,8,56,12, .edtFrist
	End Dialog

	'Dialog-Anweisungen
	Dim Dlg1 as Fristsetzung		
	Dlg1.edtFrist = Dateserial(Year(Date), Month(Date), Day(Date) + 18)				'	Es wird eine Frist zum heutigen Datum zugerechnet (14 Tage Frist + 4 Tage Postlaufzeit = 18 Tage) und bei Intialisierung des Dialogs in die Edit_Box "edtFrist" eingefuegt
	IF Weekday(Dlg1.edtFrist) = 7 Then															' 	Faellt das Datum der Fristsetzung auf einen Samstag wird diese um 2 Tage verlaengert.
		Dlg1.edtFrist = Dateserial(Year(Date), Month(Date), Day(Date) + 20)							
	ElseIf Weekday(Dlg1.edtFrist) = 1 Then														' 	Faellt das Datum der Fristsetzung auf einen Sonntag wird diese um 1 Tag verlaengert.
		Dlg1.edtFrist = Dateserial(Year(Date), Month(Date), Day(Date) + 19)
	End If

	'Dlg1.edtFrist = Format(Dlg1.edtFrist, "Long Date")									'	Formatierung der Edit_Box als Datum mit Wochentags und voller Monatsangabe

	Button = Dialog(Dlg1)


	'	Beispiel Übertrag nach TM (mir kommt es auf die letzte Zeile an, den Übertrag nach TM habe ich nicht im Handbuch gefunden)

	'	Dim tm as Object

	'	Set tm = CreateObject("TextMaker.Application")
	
	'	If tm.Application.Visible  = True Then
	'		tm.Application.Documents.Add("Dateipfad\Dateiname.tmvx")
	'		tm.Application.ActiveDocument.Activate
	'	Else
	'		tm.Application.Visible = true
	'		tm.Application.Documents.Add("Dateipfad\Dateiname.tmvx.tmvx")
	'		tm.Application.ActiveDocument.Activate
	'	End If

	'tm.Application.ActiveDocument.FormFields("TextBox1").TextInput.Text = Dlg1.edtFrist

End Sub
