Dear All,
I've been using this code snippet from MS in Office 2003, 2007 and its been working fine no issues. I've upgraded to Office 2010 and the code not working I think I've found why but can’t think of the way around it any help would be gladly received.
Line 3 sCurrentPrinter = Trim$(Left$(ActivePrinter, _
InStr(ActivePrinter, " on ")))
This in office 2003/2007 shows sCurrnetPrinter as the local printer yet in 2010 it does not the InStr(ActivePrinter, “ on “))) Functions shows the active printer and port “ on “ Port Name yet using 2010 it only shows the printer name.
Public Function GetBinNumbers() As Variant
'Code adapted from Microsoft KB article Q194789
'HOWTO: Determine Available PaperBins with DeviceCapabilities API
Dim iBins As Long
Dim iBinArray() As Integer
Dim sPort As String
Dim sCurrentPrinter As String
'Get the printer & port name of the current printer
sPort = Trim$(Mid$(ActivePrinter, InStrRev(ActivePrinter, " ") + 1))
sCurrentPrinter = Trim$(Left$(ActivePrinter, _
InStr(ActivePrinter, " on ")))
'Find out how many printer bins there are
iBins = DeviceCapabilities(sCurrentPrinter, sPort, _
DC_BINS, ByVal vbNullString, 0)
'Set the array of bin numbers to the right size
ReDim iBinArray(0 To iBins - 1)
'Load the array with the bin numbers
iBins = DeviceCapabilities(sCurrentPrinter, sPort, _
DC_BINS, iBinArray(0), 0)
'Return the array to the calling routine
GetBinNumbers = iBinArray
End Function
I've been using this code snippet from MS in Office 2003, 2007 and its been working fine no issues. I've upgraded to Office 2010 and the code not working I think I've found why but can’t think of the way around it any help would be gladly received.
Line 3 sCurrentPrinter = Trim$(Left$(ActivePrinter, _
InStr(ActivePrinter, " on ")))
This in office 2003/2007 shows sCurrnetPrinter as the local printer yet in 2010 it does not the InStr(ActivePrinter, “ on “))) Functions shows the active printer and port “ on “ Port Name yet using 2010 it only shows the printer name.
Public Function GetBinNumbers() As Variant
'Code adapted from Microsoft KB article Q194789
'HOWTO: Determine Available PaperBins with DeviceCapabilities API
Dim iBins As Long
Dim iBinArray() As Integer
Dim sPort As String
Dim sCurrentPrinter As String
'Get the printer & port name of the current printer
sPort = Trim$(Mid$(ActivePrinter, InStrRev(ActivePrinter, " ") + 1))
sCurrentPrinter = Trim$(Left$(ActivePrinter, _
InStr(ActivePrinter, " on ")))
'Find out how many printer bins there are
iBins = DeviceCapabilities(sCurrentPrinter, sPort, _
DC_BINS, ByVal vbNullString, 0)
'Set the array of bin numbers to the right size
ReDim iBinArray(0 To iBins - 1)
'Load the array with the bin numbers
iBins = DeviceCapabilities(sCurrentPrinter, sPort, _
DC_BINS, iBinArray(0), 0)
'Return the array to the calling routine
GetBinNumbers = iBinArray
End Function