|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sending Printer CommandsI need to send Page Setup commands to the printer via VB-6. I have a report
that prints bar codes. I have to set the printer for the report to the Default Printer because I don't know what bar code printer the user will be using. Via code I can set the printer to the user's bar code printer, but it seems to print with the page properties of the default printer. I want to send the page width and height to the printer via code so it prints correctly, but don't know how. Help? --Tony-- The printer is no different than any other form when it comes to sizing.
Just set your requirements with printer.width and printer.height. Regards The Peasant Show quoteHide quote "Tony" <T***@discussions.microsoft.com> wrote in message news:AFB296A4-9C1A-45FC-9600-DF824206987D@microsoft.com... >I need to send Page Setup commands to the printer via VB-6. I have a >report > that prints bar codes. I have to set the printer for the report to the > Default Printer because I don't know what bar code printer the user will > be > using. Via code I can set the printer to the user's bar code printer, but > it > seems to print with the page properties of the default printer. I want to > send the page width and height to the printer via code so it prints > correctly, but don't know how. Help? > --Tony-- > Thanks, but that's not working for some reason. Here is the code I am using
where idxnum is the index number of the barcode printer: Set Application.Printer = Application.Printers(idxNum) Set prtDefault = Application.Printer With prtDefault .TopMargin = 0 .BottomMargin = 0 .RightMargin = 0 .LeftMargin = 0 .DefaultSize = False .ItemSizeHeight = 715 .ItemSizeWidth = 2880 End With The label is 2 inches by .5 inches and when it prints one label, it feeds through about 10 or 12 of them like it was feeding a full sheet of paper. I want it to stop after each label. Show quoteHide quote "The Peasant" wrote: > The printer is no different than any other form when it comes to sizing. > Just set your requirements with printer.width and printer.height. > Regards > The Peasant > > "Tony" <T***@discussions.microsoft.com> wrote in message > news:AFB296A4-9C1A-45FC-9600-DF824206987D@microsoft.com... > >I need to send Page Setup commands to the printer via VB-6. I have a > >report > > that prints bar codes. I have to set the printer for the report to the > > Default Printer because I don't know what bar code printer the user will > > be > > using. Via code I can set the printer to the user's bar code printer, but > > it > > seems to print with the page properties of the default printer. I want to > > send the page width and height to the printer via code so it prints > > correctly, but don't know how. Help? > > --Tony-- > > > > > Thanks, but that's not working for some reason. Here is the code I am You said this is a VB6 question... but what object is "Application"? Can you > using > where idxnum is the index number of the barcode printer: > > Set Application.Printer = Application.Printers(idxNum) > Set prtDefault = Application.Printer provide more information about it? Rick Sorry, I'm actually using VBA, but was unable to get an answer to my
question in that forum. I was hoping that because of the similarity between VB6 and VBA I could find help here. Show quoteHide quote "Rick Rothstein (MVP - VB)" wrote: > > Thanks, but that's not working for some reason. Here is the code I am > > using > > where idxnum is the index number of the barcode printer: > > > > Set Application.Printer = Application.Printers(idxNum) > > Set prtDefault = Application.Printer > > You said this is a VB6 question... but what object is "Application"? Can you > provide more information about it? > > Rick > > > So do you want it to print just one per page?
TP Show quoteHide quote "Tony" <T***@discussions.microsoft.com> wrote in message news:975C098E-87CC-4DC2-AB7B-CFAC1790DB4F@microsoft.com... > Sorry, I'm actually using VBA, but was unable to get an answer to my > question in that forum. I was hoping that because of the similarity > between > VB6 and VBA I could find help here. > > "Rick Rothstein (MVP - VB)" wrote: > >> > Thanks, but that's not working for some reason. Here is the code I am >> > using >> > where idxnum is the index number of the barcode printer: >> > >> > Set Application.Printer = Application.Printers(idxNum) >> > Set prtDefault = Application.Printer >> >> You said this is a VB6 question... but what object is "Application"? Can >> you >> provide more information about it? >> >> Rick >> >> >> Yes, each "page" is only .5 inches in height and 2 inches wide. I want the
printer to print one single label then stop feeding the paper roll. Seems simple, but its not. Show quoteHide quote "The Peasant" wrote: > So do you want it to print just one per page? > TP > > "Tony" <T***@discussions.microsoft.com> wrote in message > news:975C098E-87CC-4DC2-AB7B-CFAC1790DB4F@microsoft.com... > > Sorry, I'm actually using VBA, but was unable to get an answer to my > > question in that forum. I was hoping that because of the similarity > > between > > VB6 and VBA I could find help here. > > > > "Rick Rothstein (MVP - VB)" wrote: > > > >> > Thanks, but that's not working for some reason. Here is the code I am > >> > using > >> > where idxnum is the index number of the barcode printer: > >> > > >> > Set Application.Printer = Application.Printers(idxNum) > >> > Set prtDefault = Application.Printer > >> > >> You said this is a VB6 question... but what object is "Application"? Can > >> you > >> provide more information about it? > >> > >> Rick > >> > >> > >> > >
Show quote
Hide quote
>> > Thanks, but that's not working for some reason. Here is the code I am Similar, but there are large differences too. The handling of the printer >> > using >> > where idxnum is the index number of the barcode printer: >> > >> > Set Application.Printer = Application.Printers(idxNum) >> > Set prtDefault = Application.Printer >> >> You said this is a VB6 question... but what object is "Application"? Can >> you >> provide more information about it? > > Sorry, I'm actually using VBA, but was unable to get an answer to my > question in that forum. I was hoping that because of the similarity > between > VB6 and VBA I could find help here. seems to be one area where they differ. I don't think you can control the printer in the same way as in VB6. First of all, there is no Printer property to the Application object, but there is a ActivePrinter property. However, it doesn't have properties of its own. It looks like the control of the print out is done from a Document (maybe ActiveDocument) object instead of a Printer object, but I am not totally sure of that as I don't program in VBA. My suggestion is to keep trying in a VBA newsgroup until someone answers your question. Rick Thanks Rick.. I have posted it in a couple of newsgroups hoping to get some
help with this. It seems to be one of those areas that no one seems to know a whole lot about. Show quoteHide quote "Rick Rothstein (MVP - VB)" wrote: > >> > Thanks, but that's not working for some reason. Here is the code I am > >> > using > >> > where idxnum is the index number of the barcode printer: > >> > > >> > Set Application.Printer = Application.Printers(idxNum) > >> > Set prtDefault = Application.Printer > >> > >> You said this is a VB6 question... but what object is "Application"? Can > >> you > >> provide more information about it? > > > > Sorry, I'm actually using VBA, but was unable to get an answer to my > > question in that forum. I was hoping that because of the similarity > > between > > VB6 and VBA I could find help here. > > Similar, but there are large differences too. The handling of the printer > seems to be one area where they differ. I don't think you can control the > printer in the same way as in VB6. First of all, there is no Printer > property to the Application object, but there is a ActivePrinter property. > However, it doesn't have properties of its own. It looks like the control of > the print out is done from a Document (maybe ActiveDocument) object instead > of a Printer object, but I am not totally sure of that as I don't program in > VBA. My suggestion is to keep trying in a VBA newsgroup until someone > answers your question. > > Rick > > > |
|||||||||||||||||||||||