![]() |
is word really smarter than excel?
Jezbel from the word vba newsgroup wrote...........
The difference must lie elsewhere. VBA is exactly the same in both cases -- literally: it's the same library. My question remains................ "Bill Kuunders" wrote in message ... The code below is for an excel routine to find the port number for a network printer. The portnumbers are selected at random when logging on to the network. For us it is normally ne01 ne02 ne03 or ne04 Dim OldPname As String Dim TempPname As String OldPname = Application.ActivePrinter For J = 0 To 99 On Error Resume Next If J < 10 Then TempPname = "Adobe PDF on Ne0" & J & ":" Application.ActivePrinter = TempPname ElseIf J = 10 Then TempPname = "Adobe PDF on Ne" & J & ":" Application.ActivePrinter = TempPname End If If Application.ActivePrinter = TempPname Then Exit For End If Next J Application.ActivePrinter = "TempPname" ThisWorkbook.Worksheets(1).PrintOut , Copies:=1,ActivePrinter: _ =TempPname, Collate:=True Application.ActivePrinter = OldPname The code works perfect. My question is.............. Why does word not need to go through the loop of allocating numbers until there is a match? In word these two lines return the right printer including the right port TempPname = "Adobe PDF " Application.ActivePrinter = TempPname Do I really have to admit that word is smarter than excel? Regards Bill Kuunders |
is word really smarter than excel?
If you print manually, instead of using VBA, how does Adobe appear in the
Print dialog? It looks like in Excel you need to specify "Adobe PDF on ..." with the port number but in Word it just recognizes it as "Adobe PDF". The printer name is a Windows setting so I don't know why it would be different between the two apps. "Bill Kuunders" wrote: Jezbel from the word vba newsgroup wrote........... The difference must lie elsewhere. VBA is exactly the same in both cases -- literally: it's the same library. My question remains................ "Bill Kuunders" wrote in message ... The code below is for an excel routine to find the port number for a network printer. The portnumbers are selected at random when logging on to the network. For us it is normally ne01 ne02 ne03 or ne04 Dim OldPname As String Dim TempPname As String OldPname = Application.ActivePrinter For J = 0 To 99 On Error Resume Next If J < 10 Then TempPname = "Adobe PDF on Ne0" & J & ":" Application.ActivePrinter = TempPname ElseIf J = 10 Then TempPname = "Adobe PDF on Ne" & J & ":" Application.ActivePrinter = TempPname End If If Application.ActivePrinter = TempPname Then Exit For End If Next J Application.ActivePrinter = "TempPname" ThisWorkbook.Worksheets(1).PrintOut , Copies:=1,ActivePrinter: _ =TempPname, Collate:=True Application.ActivePrinter = OldPname The code works perfect. My question is.............. Why does word not need to go through the loop of allocating numbers until there is a match? In word these two lines return the right printer including the right port TempPname = "Adobe PDF " Application.ActivePrinter = TempPname Do I really have to admit that word is smarter than excel? Regards Bill Kuunders |
is word really smarter than excel?
Yes, word is smarter. Printing is through the application, not VBA and
excel needs the port. -- Regards, Tom Ogilvy "Bill Kuunders" wrote in message ... Jezbel from the word vba newsgroup wrote........... The difference must lie elsewhere. VBA is exactly the same in both cases -- literally: it's the same library. My question remains................ "Bill Kuunders" wrote in message ... The code below is for an excel routine to find the port number for a network printer. The portnumbers are selected at random when logging on to the network. For us it is normally ne01 ne02 ne03 or ne04 Dim OldPname As String Dim TempPname As String OldPname = Application.ActivePrinter For J = 0 To 99 On Error Resume Next If J < 10 Then TempPname = "Adobe PDF on Ne0" & J & ":" Application.ActivePrinter = TempPname ElseIf J = 10 Then TempPname = "Adobe PDF on Ne" & J & ":" Application.ActivePrinter = TempPname End If If Application.ActivePrinter = TempPname Then Exit For End If Next J Application.ActivePrinter = "TempPname" ThisWorkbook.Worksheets(1).PrintOut , Copies:=1,ActivePrinter: _ =TempPname, Collate:=True Application.ActivePrinter = OldPname The code works perfect. My question is.............. Why does word not need to go through the loop of allocating numbers until there is a match? In word these two lines return the right printer including the right port TempPname = "Adobe PDF " Application.ActivePrinter = TempPname Do I really have to admit that word is smarter than excel? Regards Bill Kuunders |
is word really smarter than excel?
Thanks Tom
I've seen a lot of your answers over the years so I do believe you. What can I say...................It is more than likely way above my head. I'm just disappointed that excel couldn't do the same. I still like excel though. Regards Bill K "Tom Ogilvy" wrote in message ... Yes, word is smarter. Printing is through the application, not VBA and excel needs the port. -- Regards, Tom Ogilvy "Bill Kuunders" wrote in message ... Jezbel from the word vba newsgroup wrote........... The difference must lie elsewhere. VBA is exactly the same in both cases -- literally: it's the same library. My question remains................ "Bill Kuunders" wrote in message ... The code below is for an excel routine to find the port number for a network printer. The portnumbers are selected at random when logging on to the network. For us it is normally ne01 ne02 ne03 or ne04 Dim OldPname As String Dim TempPname As String OldPname = Application.ActivePrinter For J = 0 To 99 On Error Resume Next If J < 10 Then TempPname = "Adobe PDF on Ne0" & J & ":" Application.ActivePrinter = TempPname ElseIf J = 10 Then TempPname = "Adobe PDF on Ne" & J & ":" Application.ActivePrinter = TempPname End If If Application.ActivePrinter = TempPname Then Exit For End If Next J Application.ActivePrinter = "TempPname" ThisWorkbook.Worksheets(1).PrintOut , Copies:=1,ActivePrinter: _ =TempPname, Collate:=True Application.ActivePrinter = OldPname The code works perfect. My question is.............. Why does word not need to go through the loop of allocating numbers until there is a match? In word these two lines return the right printer including the right port TempPname = "Adobe PDF " Application.ActivePrinter = TempPname Do I really have to admit that word is smarter than excel? Regards Bill Kuunders |
is word really smarter than excel?
Thanks K Dales
I will try that out at work tomorrow. Regards Bill K "K Dales" wrote in message ... If you print manually, instead of using VBA, how does Adobe appear in the Print dialog? It looks like in Excel you need to specify "Adobe PDF on ..." with the port number but in Word it just recognizes it as "Adobe PDF". The printer name is a Windows setting so I don't know why it would be different between the two apps. "Bill Kuunders" wrote: Jezbel from the word vba newsgroup wrote........... The difference must lie elsewhere. VBA is exactly the same in both cases -- literally: it's the same library. My question remains................ "Bill Kuunders" wrote in message ... The code below is for an excel routine to find the port number for a network printer. The portnumbers are selected at random when logging on to the network. For us it is normally ne01 ne02 ne03 or ne04 Dim OldPname As String Dim TempPname As String OldPname = Application.ActivePrinter For J = 0 To 99 On Error Resume Next If J < 10 Then TempPname = "Adobe PDF on Ne0" & J & ":" Application.ActivePrinter = TempPname ElseIf J = 10 Then TempPname = "Adobe PDF on Ne" & J & ":" Application.ActivePrinter = TempPname End If If Application.ActivePrinter = TempPname Then Exit For End If Next J Application.ActivePrinter = "TempPname" ThisWorkbook.Worksheets(1).PrintOut , Copies:=1,ActivePrinter: _ =TempPname, Collate:=True Application.ActivePrinter = OldPname The code works perfect. My question is.............. Why does word not need to go through the loop of allocating numbers until there is a match? In word these two lines return the right printer including the right port TempPname = "Adobe PDF " Application.ActivePrinter = TempPname Do I really have to admit that word is smarter than excel? Regards Bill Kuunders |
All times are GMT +1. The time now is 09:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com