+ Reply to Thread
Results 1 to 11 of 11

Updating Code for 64bit Office

  1. #1
    Registered User
    Join Date
    11-21-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    20

    Updating Code for 64bit Office

    Hi, I am new to using VBA and so far have been able to muddle my way through creating userforms to enter data into spreadsheets by reading all the different forums and copying and altering various bits of code. Worked fine at home setting everything up until I got to the office and found that most of our computers run the 64 bit version office 2010. Can anyone help me with altering the following code to make PtrSafe so that the rest of the code will run on either 32bit or 64 bit office.

    Any help or advice greatly appreciated !

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 11-21-2013 at 10:51 PM. Reason: Added Code Tags

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Updating Code for 64bit Office

    I think this is the best reference page for you: http://www.jkp-ads.com/Articles/apideclarations.asp

  3. #3
    Registered User
    Join Date
    11-21-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Updating Code for 64bit Office

    Thanks for the quick reply ... I have had a quick look at the link but it will take me some time to understand the information fully. Will read it all and have a go at changing the code to suit and will post back how I got on.

    Cheers
    Darryl

  4. #4
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Updating Code for 64bit Office

    Mostly remember hWnd must be a LongPtr and a function that returns a handle is also a LongPtr. You have two functions that require Win64 conditional compilation but the article shows them well.

  5. #5
    Registered User
    Join Date
    11-21-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Updating Code for 64bit Office

    Thanks for the help !

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Updating Code for 64bit Office

    For those who are interested, here are the Windows 64 API function calls...

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    11-21-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Updating Code for 64bit Office

    Hi Leith,

    Thanks heaps .. I had managed to get it 90% right under my own steam albeit with a few errors but your code worked a treat.

    Much appreciated

    [SOLVED]
    Last edited by D.A.S; 11-22-2013 at 12:21 AM.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Updating Code for 64bit Office

    Hello D.A.S,

    You're welcome. 90 percent isn't bad, but the API isn't very forgiving. Usually a single mistake is all it takes to crash your code or machine.

    The basic rule is, as Izandol pointed out, all handles and memory pointers are LongPtr typed. There are 1 or 2 exceptions to this where a LongLongPtr type is used. The return value needs to checked against the API's function description. If you are unsure, check with MSDN. Generally, you can locate the function description by typing the function name into your browser bar. The writeup will tell you what type of variable is returned by the function.

  9. #9
    Registered User
    Join Date
    11-21-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Updating Code for 64bit Office

    Thanks Leith,

    Keeping notes of all advice received as I know I am many clicks away from being competent with basic VBA but only one click away from total annihilation of anything I am working on.

    Just as well God loves a try'er (So I'm told)

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Updating Code for 64bit Office

    Hello D.A.S.

    This is a great quote!
    I know I am many clicks away from being competent with basic VBA but only one click away from total annihilation of anything I am working on.
    I think I'll have it put on plaque as a reminder.

  11. #11
    Registered User
    Join Date
    11-21-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Updating Code for 64bit Office

    Pleased to have been able to give something back ... even if only a quote!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] GUID code for 32bit to work with 64bit also
    By BJ5352 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2013, 06:59 AM
  2. Replies: 3
    Last Post: 11-23-2012, 01:57 AM
  3. [SOLVED] Vba not working in 64bit excel - Please help
    By sthiru in forum Excel General
    Replies: 1
    Last Post: 09-20-2012, 10:53 AM
  4. An upgrade to 64bit Office 2010 creates a function error in a standard module?
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-26-2012, 10:05 AM
  5. 64bit XP Pro and Office 2003 excel glitches?
    By LJS in forum Excel General
    Replies: 0
    Last Post: 12-16-2005, 12:45 PM

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