27. november 2000 - 17:38Der er
19 kommentarer og 1 løsning
Udskive fra en list
Hej alle
håber nogle kan hjælpe med dette problem
jeg har en list som skal udskrives efter der er kommet nogle informationer ind i denne list. så når jeg trykker på knappen udskrives alt hvad der står i list2
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 \'Used to come up with the temp file dire \' ctory
Private Declare Function GetTempPath Lib \"kernel32\" _ Alias \"GetTempPathA\" (ByVal nBufferLength As Long, _ ByVal lpBuffer As String) As Long \'used to come up with the temp file name \'
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 Function CreateTempFile(sPrefix As String, sSuffix As String) As String Dim sTmpPath As String * 512 Dim sTmpName As String * 576 Dim nRet As Long \'Some API and string manipulation to get \' the temp file created nRet = GetTempPath(512, sTmpPath)
If (nRet > 0 And nRet < 512) Then nRet = GetTempFileName(sTmpPath, sPrefix, 0, sTmpName)
If nRet <> 0 Then sTmpName = Left$(sTmpName, _ InStr(sTmpName, vbNullChar) - 1) CreateTempFile = Left(Trim(sTmpName), Len(Trim(sTmpName)) - 3) & sSuffix End If End If End Function
Private Sub Command1_Click() Dim sTmpFile As String Dim sMsg As String Dim hFile As Long \'We\'re trying to print a richtextbox, so \' give it something to name \'it by, and make sure you set the extent \' ion to rtf. \'You could print a textbox by using txt, \' etc. sTmpFile = CreateTempFile(\"jTmp\", \"rtf\") \'Gets the next available open number hFile = FreeFile \'open the file and give it the textRTF o \' f the richtextbox \'if you don\'t want to use boxed, you cou \' ld just pass a string here Open sTmpFile For Binary As hFile For X=0 to list1.listcount-1 Put #hFile, , List1.list(i) Next Close hFile \'shell print it Call ShellExecute(0&, \"Print\", sTmpFile, vbNullString, vbNullString, vbHide) \'delete it. Kill sTmpFile End Sub
kan jeg ikke få din e-mail det er lidt lettere, du lyder til at have meget forstand på VB programmering, hvis du gider at hjælpe mig mere kan jeg bare sende en e-mail til dig.....
For i = 0 To List2.ListCount - 1 blah=blah & list2.list(i) & chr(13) Next Printer.Print blah
endnu bedre :)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.