Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
When I was trying to print to PDF file, I need to set the printer as "Adobe
PDF on Ne01", could anybody tell me what this "Ne01" means? And how can I get that kind of information before I use them in the code? Because on some other computers, it is "Ne00" instead of "Ne01". Thanks a lot! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I think Adobe PDF is the local name for the printer and Ne01 describes the
network name for the same resource. Tom Ogilvy posted some resources to check out. http://www.microsoft.com/office/comm...xp=&sloc=en-us If you can return a list (or array) of all of the printers, I would think you could loop through the listing the identify which one has "Adobe PDF" in the name (check VBA InStr function). I only have one printer so I can't fully test the macro's suggested, but the one that uses WScript.Network (which you should have seen in Tom's old posts) seemed to work okay. At the very worst, you could have the user change the activeprinter using Application.Dialogs(xlDialogPrinterSetup).Show "salut" wrote: When I was trying to print to PDF file, I need to set the printer as "Adobe PDF on Ne01", could anybody tell me what this "Ne01" means? And how can I get that kind of information before I use them in the code? Because on some other computers, it is "Ne00" instead of "Ne01". Thanks a lot! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot! That's very helpful!
But the strange thing is. When I was trying to print out the information. I just get "Adobe PDF on My Documents\*.pdf" instead of "Adobe PDF on Ne01". Could you tell me how can I get "Adobe PDF on Ne01". Thanks a lot! "JMB" wrote: I think Adobe PDF is the local name for the printer and Ne01 describes the network name for the same resource. Tom Ogilvy posted some resources to check out. http://www.microsoft.com/office/comm...xp=&sloc=en-us If you can return a list (or array) of all of the printers, I would think you could loop through the listing the identify which one has "Adobe PDF" in the name (check VBA InStr function). I only have one printer so I can't fully test the macro's suggested, but the one that uses WScript.Network (which you should have seen in Tom's old posts) seemed to work okay. At the very worst, you could have the user change the activeprinter using Application.Dialogs(xlDialogPrinterSetup).Show "salut" wrote: When I was trying to print to PDF file, I need to set the printer as "Adobe PDF on Ne01", could anybody tell me what this "Ne01" means? And how can I get that kind of information before I use them in the code? Because on some other computers, it is "Ne00" instead of "Ne01". Thanks a lot! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is that computer networked? I don't think you need to know the full printer
name to find which one is Adobe. Anyway the post I linked to did not concatentate the full printer name - sorry about that. I reposted the code from another of Tom Ogilvy's posts which should be more helpful (and changed avTmp from a string to variant and included a test for the word "Adobe"). My understanding is EnumPrinterConnections will return the printer names in pairs (local name/network name - which is why the for loop increments by 2). sConn finds the word "on" (which apparently is not universal). I included a line to search the local name for "Adobe" and, when this is found, rebuild the complete name of the printer and set the activeprinter to this printer. You can, of course, store the activeprinter to a string variable, switch to Adobe, then swich back to the previous printer. I identified some lines that can be deleted if you have XL2000 or better (previous versions did not have the Split function). If you have XL2000 or better, you can delete those lines as well as the Split97 function. Sub AdobePrinter() Dim sConn As String, WshNetwork As Object, i As Long Dim avTmp As Variant #If VBA6 Then '<< Delete? avTmp = Split(Excel.ActivePrinter, " ") #Else '<< Delete? avTmp = Split97(Excel.ActivePrinter, " ")'<< Delete? #End If '<< Delete? sConn = " " & avTmp(UBound(avTmp) - 1) & " " Set WshNetwork = CreateObject("WScript.Network") Set oPrinters = WshNetwork.EnumPrinterConnections For i = 0 To oPrinters.Count - 1 Step 2 If InStr(1, oPrinters.Item(i + 1), "Adobe", _ vbTextCompare) 0 Then _ ActivePrinter = oPrinters.Item(i + 1) & _ sConn & oPrinters.Item(i) Next End Sub Function Split97(sStr As String, sdelim As String) As Variant Split97 = Evaluate("{""" & _ Application.Substitute(sStr, sdelim, """,""") & """}") End Function "salut" wrote: Thanks a lot! That's very helpful! But the strange thing is. When I was trying to print out the information. I just get "Adobe PDF on My Documents\*.pdf" instead of "Adobe PDF on Ne01". Could you tell me how can I get "Adobe PDF on Ne01". Thanks a lot! "JMB" wrote: I think Adobe PDF is the local name for the printer and Ne01 describes the network name for the same resource. Tom Ogilvy posted some resources to check out. http://www.microsoft.com/office/comm...xp=&sloc=en-us If you can return a list (or array) of all of the printers, I would think you could loop through the listing the identify which one has "Adobe PDF" in the name (check VBA InStr function). I only have one printer so I can't fully test the macro's suggested, but the one that uses WScript.Network (which you should have seen in Tom's old posts) seemed to work okay. At the very worst, you could have the user change the activeprinter using Application.Dialogs(xlDialogPrinterSetup).Show "salut" wrote: When I was trying to print to PDF file, I need to set the printer as "Adobe PDF on Ne01", could anybody tell me what this "Ne01" means? And how can I get that kind of information before I use them in the code? Because on some other computers, it is "Ne00" instead of "Ne01". Thanks a lot! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm no expert on printers, but you get "Adobe PDF on My Documents\*.pdf",
because that is the virtual port that you have set, so Adobe defaults to that location when it "prints" its output. As such you cannot have "Adobe PDF on Ne01" because that is real port with a supposedly real printer connected. As Adobe PDF does not output real printer codes this would not be possible. NickHK "salut" wrote in message ... Thanks a lot! That's very helpful! But the strange thing is. When I was trying to print out the information. I just get "Adobe PDF on My Documents\*.pdf" instead of "Adobe PDF on Ne01". Could you tell me how can I get "Adobe PDF on Ne01". Thanks a lot! "JMB" wrote: I think Adobe PDF is the local name for the printer and Ne01 describes the network name for the same resource. Tom Ogilvy posted some resources to check out. http://www.microsoft.com/office/comm...xp=&sloc=en-us If you can return a list (or array) of all of the printers, I would think you could loop through the listing the identify which one has "Adobe PDF" in the name (check VBA InStr function). I only have one printer so I can't fully test the macro's suggested, but the one that uses WScript.Network (which you should have seen in Tom's old posts) seemed to work okay. At the very worst, you could have the user change the activeprinter using Application.Dialogs(xlDialogPrinterSetup).Show "salut" wrote: When I was trying to print to PDF file, I need to set the printer as "Adobe PDF on Ne01", could anybody tell me what this "Ne01" means? And how can I get that kind of information before I use them in the code? Because on some other computers, it is "Ne00" instead of "Ne01". Thanks a lot! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I must have misread. When the OP stated that it was Ne00 on other computers
I assumed he meant they actually had "Adobe on Ne00". He must be talking about the other printers that are installed. Obviously, I know little about printers. I just assumed he wanted to programmatically capture and set the active printer to Adobe, not actually set the Adobe "printer" name to something different. Thanks Nick! "NickHK" wrote: I'm no expert on printers, but you get "Adobe PDF on My Documents\*.pdf", because that is the virtual port that you have set, so Adobe defaults to that location when it "prints" its output. As such you cannot have "Adobe PDF on Ne01" because that is real port with a supposedly real printer connected. As Adobe PDF does not output real printer codes this would not be possible. NickHK "salut" wrote in message ... Thanks a lot! That's very helpful! But the strange thing is. When I was trying to print out the information. I just get "Adobe PDF on My Documents\*.pdf" instead of "Adobe PDF on Ne01". Could you tell me how can I get "Adobe PDF on Ne01". Thanks a lot! "JMB" wrote: I think Adobe PDF is the local name for the printer and Ne01 describes the network name for the same resource. Tom Ogilvy posted some resources to check out. http://www.microsoft.com/office/comm...xp=&sloc=en-us If you can return a list (or array) of all of the printers, I would think you could loop through the listing the identify which one has "Adobe PDF" in the name (check VBA InStr function). I only have one printer so I can't fully test the macro's suggested, but the one that uses WScript.Network (which you should have seen in Tom's old posts) seemed to work okay. At the very worst, you could have the user change the activeprinter using Application.Dialogs(xlDialogPrinterSetup).Show "salut" wrote: When I was trying to print to PDF file, I need to set the printer as "Adobe PDF on Ne01", could anybody tell me what this "Ne01" means? And how can I get that kind of information before I use them in the code? Because on some other computers, it is "Ne00" instead of "Ne01". Thanks a lot! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
If changed array formula reduce ""\""\""\ - signs to #Missing, will it make ... | Excel Programming |