AW: Inhalt Textbox ausdrucken
03.06.2010 22:12:37
Josef
Hallo Lutz,
eine Möglichkeit.
' **********************************************************************
' Modul: Modul6 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Private Declare Function GetTempFilename Lib "kernel32" Alias _
"GetTempFileNameA" (ByVal lpszPath As String, ByVal lpPrefixString As String, _
ByVal wUnique As Long, ByVal lpTempFileName As String) As Long
Private Declare Function GetTempPath Lib "kernel32.dll" Alias "GetTempPathA" _
(ByVal nBufferLength As Long, ByVal lpBuffer As String) As Long
Private Function TextFileTempFilename(Optional Path As String, Optional suffix As String) As String
Dim myTempFileName As String
Dim RetVal As Long
If Path = "" Then
Path = Space$(256)
RetVal = GetTempPath(Len(Path), Path)
Path = Left$(Path, RetVal)
End If
myTempFileName = Space$(256)
Call GetTempFilename(Path, "txt", 0&, myTempFileName)
myTempFileName = Left$(myTempFileName, InStr(myTempFileName, Chr$(0)) - 1)
If suffix <> "" Then
myTempFileName = Replace(myTempFileName, "tmp", suffix)
End If
TextFileTempFilename = myTempFileName
End Function
Sub string_Print(ByVal strTxt As String)
Dim strFile As String, F As Integer
strFile = TextFileTempFilename(, "txt")
F = FreeFile
Open strFile For Output As #F
Print #F, strTxt
Close #F
ShellExecute 0, "Print", strFile, "", "", 0
Sleep 5000
Kill strFile
End Sub
'Aufruf
Sub test()
string_Print Textbox1
End Sub
Gruß Sepp