Outputting Text From A Textbox To The Default Printer
I would have thought it might be easy to print out the contents of a textbox, and maybe it is, maybe I missed something, either way, how can I take the contents of a textbox in a form in excel and output that to the printer?
Thanks,
-Heathen
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Opening Text File, Outputting It To Textbox
How do I open a textfile, and have it's contents outputed to a textbox? The path must be file.ext .. I looked at some of the tutorials but didn't find a direct example, tried
Dim checkfile As String
Open App.Path & "conf.cfg" For Random As checkfile
txt1.Text = checkfile
which didn't do anything, was a longshot : ... also conf.cfg, textfile saved with the extension .cfg, shouldn't be problem ...
Change Default Value In TextBox.Text
When I load my form, the TextBox.Test = 8 and I would like to change this value during run.
With the new value = 10 and when I reload the next time my form I would like optain the default value for my TextBox = 10
Is't possible?
Thanks a lot
Redg
Outputting To TextBox Rather Than A DataReport
Right now I have a SQL statement in my DataEnvironment outputting its results to a DataReport. Is there a way to output those same results to a TextBox? My code is:
Private Sub Command16_Click()
Dim strCR As String
strCR = Form1.Combo2
'close-open the rs to refresh
If DataEnvironment1.rsCommand1.State = adStateOpen Then DataEnvironment1.rsCommand1.Close
DataEnvironment1.Command1 strCR
On Error Resume Next
DataReport1.Show
End Sub
Outputting SQL Statement Result To TextBox
Greetings. I have a SQL Statement query that outputs its results into a DataReport. I'd like to be able to pipe the results to a TextBox instead. I've been to many different forums and no one seems able to answer why this isn't working.
I have set the TextBox parameters for DataSource, DataMember and DataField to that of the Connection, Command and Recordsource.
Like I said, I've searched several different forums and many people report this same problem. People ask if they bound the three parameters I listed above for the TextBox, and everyone said they did.. Then no more ideas.
I know this is done all the time, so someone must know the trick to it.
Any help would be greatly appreciated.
Set Default Paper Size For Default Printer ...
So, hope that someone could help me..hix..
If i cant do this i will loose my job, my boss say so. I have to print a webpage with the size of paper is A5 baut the default always is Letter, hix, I could change it by hand but the users may not. So i want to set the default paper size of default printer to A5.
Thanks a lot.
How Can I Change The Default Printer At Runtime To Use It With Printer.print Command?
Hi everyone,
I have a little application which uses printer.print command to do some print jobs, of course there are some other things that I print using Data Reports.
When my application starts, I think it instantiates printer object with the default printer (lx300). Once the application is started, there are some options that use printer.print, but there are options that use printer.print too but I need to print them in another printer (ip1000). I have a common dialog that lets me choose the printer, and when I choose ip1000 every printer.print call goes to lx300. I assume there's no way to "reinstantiate" printer object to print in ip1000.
Also, when I close my application ip1000 becomes my default printer. Does the common dialog can select a printer without changing the Windows default printer like Word, Excel. do?
Thanks a lot for your help
How Can I Change The Default Printer At Runtime To Use It With Printer.print Command?
Hi everyone,
I have a little application which uses printer.print command to do some print jobs, of course there are some other things that I print using Data Reports.
When my application starts, I think it instantiates printer object with the default printer (lx300). Once the application is started, there are some options that use printer.print, but there are options that use printer.print too but I need to print them in another printer (ip1000). I have a common dialog that lets me choose the printer, and when I choose ip1000 every printer.print call goes to lx300. I assume there's no way to "reinstantiate" printer object to print in ip1000.
Also, when I close my application ip1000 becomes my default printer. Does the common dialog can select a printer without changing the Windows default printer like Word, Excel. do?
Thanks a lot for your help
Changed Default Printer But Job Goes To Old Default...
I have a print command with the following code:
Code:
Private Sub cmdPrint_Click()
Dim tmpPrinter As Printer
Dim DefaultPrinter As Printer
Set DefaultPrinter = Printer ' Save the default printer
For Each tmpPrinter In Printers
If tmpPrinter.DeviceName = cmbPrinters.Text Then
Set Printer = tmpPrinter
Exit For
End If
Next tmpPrinter
CrystalReport1.ReportFileName = FileIn.Path & "" & FileIn.FileName
CrystalReport1.Destination = crptToPrinter
CrystalReport1.PrintReport
MsgBox "Your report was printed"
Set Printer = DefaultPrinter ' Change back to default printer
End Sub
where the combo box is populated by this code:
Code:
i = 0
For Each InstalledPrinters In Printers
cmbPrinters.AddItem InstalledPrinters.DeviceName
i = i + 1
Next InstalledPrinters
cmbPrinters.ListIndex = 0
I select a printer (not the default printer, but a different one) from the combo list, then click on Print and the job is still going to the original default printer. Stepping through the code, I can see how Printer changes (to the printer I selected) during the execution, but the job keeps going to the old default printer. Also the last line of code in the cmdPrint_Click sub gives me a "Run-time error '13': Type mismatch" error.
What am I missing? Can anyone help please?
Thanks,
poli
Text Align When Outputting To Text File
I have three variables here: item number, description, and price. Each line can be a maximum of 50 characters. I need the first two variables left aligned and the last one right aligned on the same line when outputting to a text file, so it looks like:
Code:
01234567890123456789012345678901234567890123456789
itemno description, color price
I already wrote functions for right alignment but I cannot figure out how to have two different alignments when outputting to the text file on the same line. Anyone have any ideas? Thanks.
How To Printer.Print To Non Default Printer
I have a small app that I need to modify. Basically it sends a report straight to the (default) printer by Printer.Print
Users want to print to their non-default printer, too. I could change the default printer by Set Printer = another Printer and then get back to the original one, but is there a better way to do it?
Have fun.
---- Andy
Outputting To A Text File
Lo all, i'm new to this so try to bare with me
I've been creating a DataBased based program for
storing people's details. I won't bore you with the details
but its basically a fancy AddressBook with new fields etc.
Could anyone tell me how to create a button that would save
all (or just the current) database entry to a text file?
Its basically so we can print the details off easier without
using "Me.Print" etc.
If its required I can post the source files in a .zip or .rar.
Outputting Text To Net Term
I'm writing code that needs to export data to a text file, but I'm unable to get it to export quotation marks.
For example, I need the text file to read:
Output "rcv:apptext!"
but the code is exporting:
Output rcv:apptext!
I've tried the print to file and write to file commands and neither seem to work. Thanks for your help!
Outputting To A Text File
Hi Everyone,
The below code is working execept for the fact that it is only displaying the very end of the data. "List1" is the name of my textbox. I have the multiline value set to true. How can I make it display all the data into a text box? Thank you.
VB Code:
If Not (IsEmpty(arrkeynames)) ThenFor Each subkey In arrkeynamesregpath = strkey & "Network" & subkeyregentry = "RemotePath"objreg.getstringvalue HKEY_USERS, regpath, regentry, dapath list1 = subkey & ":" & vbTab & dapath & vbNewLine
Outputting To A Text File.
Hi,
Does anyone have any tips (or know of any good web sites/tutorials) for neatly formatting text in an output file (.txt). I'm finding it difficult to get everything lined up with headers, and because some of the bits of data are of different length, all the bits of data in my tables are out of position.
TYIA
Pile
Outputting Text Lines?
I have a text file which contains lines of data. I only need to output certain lines based on the following criteria:-
Each new record begins with "H", ie header record. Then within each header record i can have muliple lines of "D" records, i.e detail records.
For each record beginning with "H" i
ONLY OUTPUT lines, beginning with D08 or D12 or D93
See example test lines below.
example of text file:-
H 20397337568237 company1
D90
D88
H 203866547658769 company 2
D01
D08
H 237693709283470 company3
D08
D01
There are 3 records in the above example. I do not want to output record 1,compnay 1 as it doesnt have a D08 or D12 or D93 beneath it.
I do want to output record 2,companY 2 because it has a D08 beneath it.
I do want to output record 3 , company 3, because it also has a D08 beneath it. However record 3 will not output for me when i use the code below, because D08 is not at the end of line?? Dont know why this is happening, Can anyone re-jig my if statement.
VB Code:
If useThisRecord Then '' now check through line by line to see if it contains a D93 record '' For j = 0 To UBound(strRecord) If (Left(strRecord(j), 3) = "D12") Or (Left(strRecord(j), 3) = "D08") Or Left(strRecord(j), 3) = "H20" Or (Left(strRecord(j), 3) = "D93" And Mid$(strRecord(j), 62, 1) = "S") Then useThisRecord = True Else useThisRecord = False End If ''if there is in fact a D93 record, then check if there's a P field If Left(strRecord(j), 3) = "D93" Then '' if there is a P at position 62 then this record is not okay '' useThisRecord = Not (Mid$(strRecord(j), 62, 1) = "P") End If Next End If
Outputting To Text Files
2 questions:
1) Does anyone know how to export a string to a text file without putting the quotation marks around it.
2) Anyway of stopping VB from zero suppressing integers eg stopping an input 0052 from being outputted as 52???
Outputting To Existing Text File
I am a novice programmer.
How do I output the text appearing on a label so that it outputs to an existing text file exactly as it appears on a label?
This is what I have done so far.
Private Sub PurchaseCmd_Click()
Open "D:Documents and SettingsChris LatinoDesktopProjUnmodifiedProjectpao.dat" For Append As #1
Write #1, receipt.Text
Close #1
End Sub
If Statements - Text File Outputting?
I have a program which reads a text file, line by line, then outputs certains lines to a new text file. Heres an example of a 2 lines in my text file.
H 623556348762 company1
D93
D08
H 623556898798 Company2
D08
D01
D34
Each record begins with a H, therefore in the above example i have 2 records. When the code reads the text file, it outputs those records when D08 comes last in the lines, see record 1 above(company1). BUT when D08 comes in the middle of the record it does not get outputted, see record 2, company2. So if theres a D01 or any other line after a D08 line it ignores my Rule to output.
WHY is this happening to me?!! Ive pasted the IF Statements below which take care of the selection criteria. Basically, i need to output all records which have a D08 line , no matter of its position within the record.
Thanks
xx
Paste the code below into a text file to make it more readable.
'' if this record is still okay
''
If useThisRecord Then
'' now check through line by line to see if it contains a D93 record
''
For j = 0 To UBound(strRecord)
'' if there is in fact a D93 record, then check if there's a P field
''
If Left(strRecord(j), 3) = "D93" Then
'' if there is a P at position 62 then this record is not okay
''
useThisRecord = Not (Mid$(strRecord(j), 62, 1) = "P")
If Left(strRecord(j), 3) = "D12" Or Left(strRecord(j), 3) = "D08" Or Left(strRecord(j), 3) = "D93" And Mid$(strRecord(j), 62, 1) = "S" Then
useThisRecord = True
End If
End If
'End If
Next
End If
Outputting Strings To A Text File
Hiya, what I want to do is output a series of string variables to a simple .txt file. I know how to do this, but the problem is it outputs the "" marks as well. I want to get rid of these as they can't be read by another program that reads the text file. However the program I'm writing must be able to read the values in the file back as strings. Can anyone help?
Thanx in advance,
Matt
Need Assistance In Outputting To A Text File
Hello to all,
I have a text file with customers names and their purchases over a 5 month period.
It would look like similar to whats below:
"Name", "M1", "M2", "M3", "M4", "M5"
"Harry Jones", 250, 300, 450, 100, 250
"Henny Penny", 100, 200, 150, 300, 250
"Tom Mack", 110, 320, 150, 345, 430
"Jenn Street", 320, 280, 450, 320, 840
"Mary Jacobs", 430, 350, 700, 630, 290
Using VB6 and reading this text file, lets call it customers.txt, how can I output each customers name with their calculated total purchases into another textfile lets call it custtot.txt that would look like this:
Customer name Total purchases for 5 months
"Harry Jones" 1350
"Henny Penny" 1000...
Does this make sense??
Basically I want to be able to calculate their total purchases from the input text file using VB6 and then output these calculated totals to another text file.
What is the quickest & easiest way to do this??
Thanks for any help I may get!
Cheers!
Outputting Bold Text Using Windows API
Hi
I am using VB6 and am currently drawing some text onto a picture box using the TextOut() function, how do I change the font, font size and make it bold? I can change the colour using the SetTextColor() function, but haven't been able to find how to achieve the other formatting options.
Thanks in advance,
Mark
Outputting Strings To Human Readable Text
How to I output strings as readable text in notepad
i'm using this type of output
Open "c:currentList.txt" For Random As #1 Len = 1000
put #1, 1, variable1
close #1
but this outputs as... machine language..?
Outputting Data From A Datagrid Into A Text File?
How would you go about this. I have never made a report before so I was wondering if you could tell me the best way to do this. I have a datagrid that contains data, it is logs of events happening in my program, like login, logout, etc, and I am trying to create a function so the user can export the logs to a text file. If you could help I would be very grateful
Thanks
Freezing Richtextbox From Scrolling While Outputting Text
Hi all ... just wonder if there is any codes out there that can freeze the richtextbox from scrolling when outputting a long string of text.
My problem is when outputting a large amount of lines into a richtextbox, it tends to scroll along the last line of input. I want it to be fixed at the top of the richtextbox when outputting. Sometimes .. it remains at the top ... but sometimes .. it follows the last line ... this is weird ... probably due to the system graphic memory ...
Appreciate if anyone can tell me how to freeze the richtextbox when outputting.
Thanks !
Chris
Help On Outputting Text File From Excell Cell
I am trying to output the text in excell cells.
For example how do you output text file
A B
1 2 Hello
2 5 Hi
3 28 Good
How can I output a tex file containing B1 with the
file title of A1. I also want to make separate text
files for each row.
Any advice of Help would be appriciatted
Thanks
Kuni
Help Outputting Text File Info To A Listbox
Ok, so I've come up with a program that reads in a list of names and sorts them in ascending or descending order according to the option buttons selected by the user. The only problem is I'm having some trouble outputting this information to a list box so I have no idea if my program works or not. I was hoping maybe someone could tell me what it is that I need to do to get this to output. Could it have something to do with the People subroutine?
Thanks in advance!
Default Printer
I have a network computer with a printer attached to lpt1 that I use for printing. The problem is, since the computer uses a dynamic ip I have to reconnect to the printer every time the computer restarts, it uses one of three ip addresses ( since there are three computers on the network). I have tried connecting to the printer by the computer's name, but this doesn't work. Can a small app be written to check and see if there is a printer attached to a network computer and if it's there set that printer as the default? I think I need a winsock control to "ping" the computer and if there's a response to set the printer to the default. Can this work, and if so, how can it be done/where can i learn how?
Thanks,
redrum
Default Printer
I have two printers that have been setup in my computer. One is local and the other is in the network. My program needs to print in those two printers. How can I change the default printer of my computer? Im using vb6 in Windows 98 OS.
Help! How To Set Default Printer Using VB?
I have 5 printers connected to my machine, and I set Printer(2) as default in system's Control Panel, now I want to print the data report to different printer, so I try to change printer using following VB code:
private sub command1_click()
Set rsPrinter = New Recordset
strSql = "select * from PPRINTERSITE where SITEID = '81';"
rsPrinter.Open strSql, g_dbConn, adOpenKeyset, adLockOptimistic
If Not rsPrinter.EOF Then
For Each prt In Printers
If prt.DeviceName = rsPrinter("PRINTERNAME") Then
MsgBox "Printer is " & prt.DeviceName
Set Printer = prt
Exit For
End If
Next
End If
dataReport1.PrintReport
end sub
though the message from MsgBox told me the Printer already changed to other printer ( such as Printer(0) ), but the dataReport1 still be printed in Printer(2), Can someone help me?
Thanks
Yinghong
Default Printer
Hi all, is there a way to use vb code to set the default printer to print a crystal report w/i vb? Currently there is no way to change the default printer from the crystal report (crviewer)....please help..thanks!
Get Default Printer
Hi,
I want to find an API functions that tells me the name of default printer installed on my computer. 'Printer' object from VB is not enought for what I need.
Thanks
Lucian
Add Default Printer
I need to know how to add printers (including the default) to a Windows 2000 workstation using Visual Basic code. I want to automate the process instead of manually adding. Does anyone have any code that I could use? Thanks!
Default Printer
i have a small program that basically copies information from a flex grid into excel. however, i've found that the page setup properties are not active if there aren't any printers installed.
my question is what's the best way to check for installed printers? i tried an if statement: if printer.devicename = "" then don't do the page setup properties, but i still get the error 'Problem getting printer information from the system. Make sure the printer is set up correctly.'
any thoughts?
thanks,
jb
Which Is The Default Printer
I'm using the code below to change printer queues from one to the other. I need to know if the printer is the "Default Printer" before I change it. Here is the code I'm using: Thanks for the Help.
'******************************************************
'* File: ChangePrinter
'* Created: May 2003
'* Version: 1.1c
'*
'* Main Function: Changes Printer Paths
'* Usage: ChangePrinter.VBS \ServerNameOldPrinter \ServerNameNewPrinter
'*'****************************************************
'Get the command line arguments
if (Wscript.arguments.count > 2) or (Wscript.arguments.count < 2) then
wscript.echo "You put the wrong number of arguments you need to put 2. Put the old printer path first, followed by the new printer path. ex. changeprinter \hqptrz010500 \hqptrz010501"
WScript.Quit
end if
OldPrinterPath = Wscript.arguments.item(0)
NewPrinterPath = Wscript.arguments.item(1)
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set oPrinters = WshNetwork.EnumPrinterConnections
For i = 0 to oPrinters.Count - 1 Step 2
If lcase(OldPrinterPath) = lcase(oPrinters.Item(i+1)) then
' Add the New Printer
WshNetwork.AddWindowsPrinterConnection NewPrinterPath
' Make the New Printer the Default Printer.
WshNetwork.SetDefaultPrinter NewPrinterPath
' Remove the Old Printer
WshNetwork.RemovePrinterConnection OldPrinterPath,true,true
End if
Next
Set WshNetwork = Nothing
Set oPrinters = Nothing
WScript.Quit
Set Default Printer OCX
Can't seem to put it into the code library but gonna put it here instead.
An ActiveX Combo To Find All Installed Printers and Specify The Default Printer.
Enjoy
Default Printer
Hi, I wish to get the device name of the default printer but VB's API does not do it. I did a search on the forum and found one thread, that thread has a link to another site about retrieving the default printer's device name but the site is no longer avaiable. Is there anyone that can help?
Default Printer
can anybody help me about how to use the windows default printer to print something? if there is a tutorial i think that will be best for me.
Default Printer
Well, seeing as this forum now includes "reporting" is suppose that this thread belongs here. If not, please feel free to move it.
How do I set the current printer to the default printer, having changed it to a not default printer?
P.S. I've searched a few returned entries in Google and none of them have the answer that I'm after.
Can't Set Default Printer
This is crazy. There are 2,000 topics on the default printer, but I still can't solve my problem. My program prints fine but I can't change the default printer.
I can't execute a simple command. Is there some component or reference I need in my program.
This gives me an "Object Required" error
TempString = "Canon Bubble-Jet BJC-265SP"
Set Printer = TempString
This is the code I want to use.
VB Code:
Dim strCurrentPrinter As String 'get current printer name and store itstrCurrentPrinter = Printer.DeviceName 'To set your printer as default printerSet Printer = "Your Printer Name" 'Do your codings to print Set Printer = strCurrentPrinter 'to set back the earlier printer as default
Default Printer
How to get the default printer in my machine and also check the status and print a pdf file by vb?
Set Default Printer
I have searched for some help on this, but it is very vague and/or complex.
I need to retrieve the name of the default printer, change it to Win2PDF, do some printing and then change the printer back to the old default.
The system default printer is found at hkey_current_userssoftwaremicrosoftwindows ntcurrentversionwindows.
How can I read that name, change to Win2PDF and then change back again?
PS.- I am currently using a program called sdp.exe (Set Default Printer) and it is excellent, but if the user changes their printer, my program won't work properly.
VB Default Printer
It is my understanding that the VB printer is the default system printer and the object Printer will print to the system default printer. I use the following code to change the orientation to landscape
CommonDialog1.Flags = &H40
CommonDialog1.PrinterDefault = True
CommonDialog1.ShowPrinter
On completion of the CommonDialog1.ShowPrinter the orientation in the Printer object is still protrait.
What am I missing here??????
Default Printer
what is the simplest way to set a default printer with code?
VB Default Printer
I need help restoring the default printer to an original value. I have an application that uses PrinterDefault = True so when I change the printer, it marks it as default but I need to change the default back to it's original value.
Thanks...
|