Microsoft Accessの公式ヘルプのコードが間違っている件

[Retrieve a List of Installed Printers](https://docs.microsoft.com/ja-jp/office/vba/access/concepts/printing/retrieve-a-list-of-installed-printers)
[プリンターの機能をプログラムで取得する](https://docs.microsoft.com/ja-jp/office/vba/access/concepts/printing/programmatically-retrieve-printer-capabilities)
これはAccessのコードですが、64bitを標準にしても全く書き換わっていません。
これでは動かない
##64bitの宣言
このためまず64bitの宣言が必要です。
##原因がよくわからない修正：For lngCounter = 1 To lngPaperCount - 1
元のコードは　`For lngCounter = 1 To lngPaperCount lngPaperCount`
ですがこれだとエラーが起きます。
これはプリンターのせいなのか64Bitのためなのか原因が不明です。

```vb

Option Explicit
'Microsoft Access XX.0 Object Libraryを参照設定してください。
'Accessは当然そうしなくても動きます。

#If VBA7 Then
Private Declare PtrSafe Function DeviceCapabilities Lib "winspool.drv" _
        Alias "DeviceCapabilitiesA" (ByVal lpsDeviceName As String, _
        ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, _
        ByVal lpDevMode As Long) As Long
#Else
' Declaration for the DeviceCapabilities function API call.
Private Declare Function DeviceCapabilities Lib "winspool.drv" _
    Alias "DeviceCapabilitiesA" (ByVal lpsDeviceName As String, _
    ByVal lpPort As String, ByVal iIndex As Long, lpOutput As Any, _
    ByVal lpDevMode As Long) As Long
#End If
' DeviceCapabilities function constants.
Private Const DC_PAPERNAMES = 16
Private Const DC_PAPERS = 2
Private Const DC_BINNAMES = 12
Private Const DC_BINS = 6
Private Const DEFAULT_VALUES = 0

Sub GetPaperList()
    Dim lngPaperCount As Long
    Dim lngCounter As Long
    Dim hPrinter As Long
    Dim strDeviceName As String
    Dim strDevicePort As String
    Dim strPaperNamesList As String
    Dim strPaperName As String
    Dim intLength As Integer
    Dim strMsg As String
    Dim aintNumPaper() As Integer
     
    On Error GoTo GetPaperList_Err
     
    ' Get the name and port of the default printer.
    strDeviceName = Access.Application.Printer.DeviceName
    strDevicePort = Access.Application.Printer.Port
     
    ' Get the count of paper names supported by the printer.
    lngPaperCount = DeviceCapabilities(lpsDeviceName:=strDeviceName, _
        lpPort:=strDevicePort, _
        iIndex:=DC_PAPERNAMES, _
        lpOutput:=ByVal vbNullString, _
        lpDevMode:=DEFAULT_VALUES)
     
    ' Re-dimension the array to the count of paper names.
    ReDim aintNumPaper(1 To lngPaperCount)
     
    ' Pad the variable to accept 64 bytes for each paper name.
    strPaperNamesList = String(64 * lngPaperCount, 0)
 
    ' Get the string buffer of all paper names supported by the printer.
    lngPaperCount = DeviceCapabilities(lpsDeviceName:=strDeviceName, _
        lpPort:=strDevicePort, _
        iIndex:=DC_PAPERNAMES, _
        lpOutput:=ByVal strPaperNamesList, _
        lpDevMode:=DEFAULT_VALUES)
     
    ' Get the array of all paper numbers supported by the printer.
    lngPaperCount = DeviceCapabilities(lpsDeviceName:=strDeviceName, _
        lpPort:=strDevicePort, _
        iIndex:=DC_PAPERS, _
        lpOutput:=aintNumPaper(1), _
        lpDevMode:=DEFAULT_VALUES)
     
    ' List the available paper names.
    strMsg = "Papers available for " & strDeviceName & vbCrLf
    For lngCounter = 1 To lngPaperCount - 1
         
        ' Parse a paper name from the string buffer.
        strPaperName = VBA.Mid(String:=strPaperNamesList, _
            Start:=64 * (lngCounter - 1) + 1, Length:=64)
        intLength = VBA.InStr(Start:=1, String1:=strPaperName, String2:=Chr(0)) - 1
        strPaperName = VBA.Left(String:=strPaperName, Length:=intLength)
         
        ' Add a paper number and name to text string for the message box.
        strMsg = strMsg & vbCrLf & aintNumPaper(lngCounter) _
            & vbTab & strPaperName
             
    Next lngCounter
         
    ' Show the paper names in a message box.
    MsgBox Prompt:=strMsg
 
GetPaperList_End:
    Exit Sub
     
GetPaperList_Err:
    MsgBox Prompt:=Err.Description, Buttons:=vbCritical & vbOKOnly, _
        Title:="Error Number " & Err.Number & " Occurred"
    Resume GetPaperList_End
     
End Sub


```