+ Reply to Thread
Results 1 to 3 of 3

Excel 32-bit to 64-bit

  1. #1
    Registered User
    Join Date
    11-10-2014
    Location
    Fairfax, VA
    MS-Off Ver
    Microsoft Office 2013 x64
    Posts
    1

    Unhappy Excel 32-bit to 64-bit

    Hi,
    The accounting department uses some older Excel sheets that declare functions like this:

    Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long


    After upgrading one of the users to Office 2013 Professional x64 they get the following error:

    Compile error:
    The code in this project must be updated for use on 64-bit systems.
    Please review and update Declare statements and then mark them with the PtrSafe attribute.

    I'm not too sure what that means. What do I need to do to get this working?

    Thanks,
    Stan

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Excel 32-bit to 64-bit

    Read this.

    You will need to update all API delcarations that return/use Pointers rather than Longs... so pay particular attention to references to 'PTRSAFE'

    You might find comments on this page to be a little more readable, especially if you scroll down to the section headed 'Which Longs should become LongPtr'
    Last edited by cytop; 11-10-2014 at 11:11 AM.

  3. #3
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Excel 32-bit to 64-bit

    Simple answer is you have to use an If statement...

    Please Login or Register  to view this content.
    Long answer is that it depends and you may need different declaration types in certain situations.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1