Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default VBA Printing

Hello, I'm trying to get and set the printer that is currently connected to
my laptop. I travel around and hook up to over 100 printers which are all
the same USB printer. Each time I encounter a new printer I install the
drivers for it. I then get a new printer icon, which it access's another
USB port. I then rename the printer and record the port it uses. I know how
to check if a printer exist and I know how to change the active printer
within my code. My problem is each time I add a printer the ports change
(Ne00: Ne01: Ne02 etc... This is fine. I can get from my records in my
code to get the printer based on the name given and port used. What I have
noticed is that after I connect to a printer that has been previously
installed for some reason the original port assigned has changed. So what I
would like to do is use a For/Next loop to check until the printer and port
exist or tell me that a printer hasn't been installed yet.
I think I can create this code myself except I'm not sure how to get the
for/next loop to check
Ne00: Ne01: Ne02: Ne03: Ne04: Ne05: Ne06: Ne07: Ne08: Ne09: Ne10:
Ne11: Ne12: .......
I can make it do x = 0 to 100 but I need a zero infront of the first 10
numbers.

Thanks in Advance once Again!
Craig




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default VBA Printing

Craig,

I would be inclined to use the Like operator or InStr.
However, I don't know how or where your data is set up.
The following may answer your question...
'-------------------------
Sub PrinterNumberTest()
Dim x As Long
Dim y As String
For x = 1 To 100
y = Format$(x, "00")
Next
End Sub
'----------------------

Jim Cone
San Francisco, USA


"Craig" wrote in message
news:uIV1f.107709$oW2.91671@pd7tw1no
Hello, I'm trying to get and set the printer that is currently connected to
my laptop. I travel around and hook up to over 100 printers which are all
the same USB printer. Each time I encounter a new printer I install the
drivers for it. I then get a new printer icon, which it access's another
USB port. I then rename the printer and record the port it uses. I know how
to check if a printer exist and I know how to change the active printer
within my code. My problem is each time I add a printer the ports change
(Ne00: Ne01: Ne02 etc... This is fine. I can get from my records in my
code to get the printer based on the name given and port used. What I have
noticed is that after I connect to a printer that has been previously
installed for some reason the original port assigned has changed. So what I
would like to do is use a For/Next loop to check until the printer and port
exist or tell me that a printer hasn't been installed yet.
I think I can create this code myself except I'm not sure how to get the
for/next loop to check
Ne00: Ne01: Ne02: Ne03: Ne04: Ne05: Ne06: Ne07: Ne08: Ne09: Ne10:
Ne11: Ne12: .......
I can make it do x = 0 to 100 but I need a zero infront of the first 10
numbers.
Thanks in Advance once Again!
Craig
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default VBA Printing

Thanks Jim,
This seem to work fine... do you think the Like operator or InStr would be
better?
I save certain information about each location in a worksheet which is
accessed by store number automatically.
IE store data, printer name, port used... but I will be removing the port
used since it changes anyway, this is where I will use the for/next loop
instead.
So Store 14811 would be sheet1 Row 2... 14812 would be sheet1 Row
3.....etc......
I place data needed for each store in the columns within their Rows... so I
have about 50 columns in use for each row.
Craig

"Jim Cone" wrote in message
...
Craig,

I would be inclined to use the Like operator or InStr.
However, I don't know how or where your data is set up.
The following may answer your question...
'-------------------------
Sub PrinterNumberTest()
Dim x As Long
Dim y As String
For x = 1 To 100
y = Format$(x, "00")
Next
End Sub
'----------------------

Jim Cone
San Francisco, USA


"Craig" wrote in message
news:uIV1f.107709$oW2.91671@pd7tw1no
Hello, I'm trying to get and set the printer that is currently connected
to
my laptop. I travel around and hook up to over 100 printers which are all
the same USB printer. Each time I encounter a new printer I install the
drivers for it. I then get a new printer icon, which it access's another
USB port. I then rename the printer and record the port it uses. I know
how
to check if a printer exist and I know how to change the active printer
within my code. My problem is each time I add a printer the ports change
(Ne00: Ne01: Ne02 etc... This is fine. I can get from my records in my
code to get the printer based on the name given and port used. What I have
noticed is that after I connect to a printer that has been previously
installed for some reason the original port assigned has changed. So what
I
would like to do is use a For/Next loop to check until the printer and
port
exist or tell me that a printer hasn't been installed yet.
I think I can create this code myself except I'm not sure how to get the
for/next loop to check
Ne00: Ne01: Ne02: Ne03: Ne04: Ne05: Ne06: Ne07: Ne08: Ne09:
Ne10:
Ne11: Ne12: .......
I can make it do x = 0 to 100 but I need a zero infront of the first 10
numbers.
Thanks in Advance once Again!
Craig



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default VBA Printing

Craig,

I don't know, however...
Reliability and speed is what I look for.
If the code does what you want, all the time, and doesn't have
a noticeable delay, I wouldn't worry about it.

Regards,
Jim Cone
San Francisco, USA


"Craig" wrote in message
news:24X1f.108269$oW2.45986@pd7tw1no...
Thanks Jim,
This seem to work fine... do you think the Like operator or InStr would be
better?
I save certain information about each location in a worksheet which is
accessed by store number automatically.
IE store data, printer name, port used... but I will be removing the port
used since it changes anyway, this is where I will use the for/next loop
instead.
So Store 14811 would be sheet1 Row 2... 14812 would be sheet1 Row
3.....etc......
I place data needed for each store in the columns within their Rows... so I
have about 50 columns in use for each row.
Craig

"Jim Cone" wrote in message
...
Craig,
I would be inclined to use the Like operator or InStr.
However, I don't know how or where your data is set up.
The following may answer your question...
'-------------------------
Sub PrinterNumberTest()
Dim x As Long
Dim y As String
For x = 1 To 100
y = Format$(x, "00")
Next
End Sub
'----------------------
Jim Cone
San Francisco, USA


"Craig" wrote in message
news:uIV1f.107709$oW2.91671@pd7tw1no
Hello, I'm trying to get and set the printer that is currently connected
to
my laptop. I travel around and hook up to over 100 printers which are all
the same USB printer. Each time I encounter a new printer I install the
drivers for it. I then get a new printer icon, which it access's another
USB port. I then rename the printer and record the port it uses. I know
how
to check if a printer exist and I know how to change the active printer
within my code. My problem is each time I add a printer the ports change
(Ne00: Ne01: Ne02 etc... This is fine. I can get from my records in my
code to get the printer based on the name given and port used. What I have
noticed is that after I connect to a printer that has been previously
installed for some reason the original port assigned has changed. So what
I
would like to do is use a For/Next loop to check until the printer and
port
exist or tell me that a printer hasn't been installed yet.
I think I can create this code myself except I'm not sure how to get the
for/next loop to check
Ne00: Ne01: Ne02: Ne03: Ne04: Ne05: Ne06: Ne07: Ne08: Ne09:
Ne10:
Ne11: Ne12: .......
I can make it do x = 0 to 100 but I need a zero infront of the first 10
numbers.
Thanks in Advance once Again!
Craig



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 printing problem--printing 1 document on 2 pages Bons Excel Discussion (Misc queries) 0 December 24th 09 04:15 PM
Excel Printing --Borders are not printing on the same page as data Stup88 Excel Discussion (Misc queries) 1 August 7th 07 09:34 AM
Printing a heading on each new page when printing Brian Excel Discussion (Misc queries) 3 November 15th 06 05:22 PM
Enable Double sided printing contiuously when printing multiple s. Lee Excel Discussion (Misc queries) 1 November 27th 04 01:58 AM
Printing? Worksheets not printing the same on multiple pc's! 43fan Excel Programming 2 April 29th 04 02:34 PM


All times are GMT +1. The time now is 11:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"