Please Review and Update Declare Statements and Then Mark Them With the Ptrsafe

  1. #1

    The code in this project must be updated for employ on 64-bit systems

    I have a projection that I'm working on for my Daughter and she gets the in a higher place error message...how practise I resolve it?
    She gets this error bulletin...
    "The Code in this Project must be updated to use on 64-bit systems. Please review and update Declare statements and then marker them with PtrSafe aspect".
    I'm running Windows x 64 Fleck and it runs fine on my auto...my Girl is running Windows 365 64 Bit on her machine and gets the above referenced error.
    Concluding edited by jaslake; xi-23-2019 at 09:59 PM.

    John

    If you take issues with Code I've provided, I capeesh your feedback.

    In the effect Lawmaking provided resolves your issue, please mark your Thread equally SOLVED.

    If you're satisfied by whatever members response to your issue please use the star icon at the lower left of their post.


  2. #2

    Re: The code in this projection must be updated for use on 64-bit systems

    In that location's an article all most this here: https://docs.microsoft.com/en-us/off...tions-overview

    On that folio it says this:

    Note

    Declare statements with the PtrSafe keyword is the recommended syntax. Declare statements that include PtrSafe work correctly in the VBA7 development environment on both 32-bit and 64-bit platforms.

    To ensure backwards compatibility in VBA7 and earlier utilise the post-obit construct:
    VB

    Consider the following Declare argument examples. Running the unmodified Declare statement in 64-chip versions of Part volition event in an fault indicating that the Declare statement does non include the PtrSafe qualifier. The modified VBA example contains the PtrSafe qualifier, but notice that the return value (a pointer to the agile window) returns a Long data type. On 64-fleck Function, this is incorrect because the pointer needs to be 64-$.25. The PtrSafe qualifier tells the compiler that the Declare argument is targeting 64-bits, so the statement executes without error. Only because the return value has not been updated to a 64-chip data type, the return value is truncated, resulting in an wrong value returned.

    Ali



    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code yous've been given: assist here. More about the Power suite here.

    Don't forget to say "thanks" to those who have helped you in your thread. If you wish, you lot tin can also advantage them by clicking on their reputation star bottom left.


  3. #3

    Re: The code in this project must be updated for use on 64-bit systems

    Hi Ali...thanks for your response...I'1000 familiar with your reference...I simply don't know how to use information technology. Where does the Lawmaking go...and what does the Lawmaking look like?

  4. #4

    Re: The code in this projection must be updated for use on 64-bit systems

    For anyone to be able to help you, y'all'll need to postal service the lawmaking you lot are using.

  5. #v

    Re: The code in this project must be updated for use on 64-flake systems

    Quote Originally Posted by AliGW View Post

    For anyone to exist able to help y'all, you'll need to post the code you are using.

    This is the Code that I have modified...haven't tested information technology nevertheless as it's running on my Daughters 64 Chip Excel...she'southward not home at the moment so I cannot have her test it. Please look at information technology and tell me is you run across any obvious errors...
    Thanks... and and
    Last edited by jaslake; 11-24-2019 at 05:42 PM.

  6. #half dozen

    Re: The code in this project must be updated for use on 64-fleck systems

    64 bit declarations for well-nigh if not all of the functions are in the attached text file (.zipped) I downloaded from Microsoft.

    The URL I used was: https://www.microsoft.com/en-united states/downwardly...07fcc4c04=True
    The link gives yous a .exe file. When you run the .exe file it installs the text file somewhere, just I just tried it again, and tin't notice where (typical Microsoft transparency).

    Lewis


  7. #7

    Re: The code in this project must be updated for use on 64-flake systems

    Thanks Lewis...I'll look at it and run into if I can make sense of it.
    John

  8. #8

    Re: The code in this projection must be updated for utilise on 64-bit systems

    Information technology would be simpler if y'all just posted all the code, or the workbook.

    In addition to changing the API declarations, you will also need to change some of the variables you are using - eg where a function returns a LongPtr non a Long in 64bit Office. And notation that y'all don't simply alter all Longs to LongPtr. Leith'south code should start like this:

    Last edited by rorya; 11-25-2019 at 07:06 AM.

    Rory


  9. #9

    Re: The code in this project must be updated for use on 64-fleck systems

    All...
    My Daughter is coming into town this weekend...we'll examination the File and Code on her 64 chip Excel platform...see if we tin can make it work. I'll more than than likely mail the entire Project on the Forum. The Projection contains an xlsm file and an xla file and a LOT of Code...cheers for your support.

    Problem is...I cannot test on my platform as I have 32 bit Excel...so...we'll see...

    Concluding edited by jaslake; 11-26-2019 at 08:34 PM.

  10. #10

    Re: The code in this project must be updated for utilise on 64-bit systems

    Quote Originally Posted past LJMetzger View Post

    When y'all run the .exe file information technology installs the text file somewhere, only I just tried it again, and can't detect where

    For me, it extracts to C:\Office 2010 Developer Resources\Documents\Office2010Win32API_PtrSafe\

  11. #11

    Re: The code in this project must be updated for apply on 64-bit systems

    I'm attaching 2 Files which appear to run just fine on Excel 2010 32 fleck. My youngest Daughter has Office 365 Excel 64 Chip and get'due south the mistake message previously referred to in Mail service 1. I'm trying to convince her to supercede her Office Excel 365 64 Fleck with Office 365 Excel 32 Bit...we'll have that conversation tomorrow (Sunday). In the concurrently, if you will, what Code changes need fabricated to make the Lawmaking in the fastened run on Part 365 Excel 64 Flake.

    The 2 Files are:

    • Pea's Ramsey.xlsm
    • Budget Macros.xlsm...this File is an addin and volition demand to be renamed Budget Macros.xla and a reference will demand to exist gear up to it in Pea's Ramsey.xlsm if it's not already in that location.
    The Code in both Workbooks will need to be modified to run in 64 Bit. I suspect nigh if not all mods will be required in the Budget Macros.xla workbook.
    I'll capeesh any help you can give.
    Terminal edited past jaslake; 12-01-2019 at 01:01 AM.

  12. #12

    Re: The lawmaking in this projection must be updated for use on 64-bit systems

    As far equally I can see, none of the lawmaking in the workbook needs changing (although there is a lot of stuff that could be tidier ) but I've amended everything I call back needs irresolute in the attached version of the add-in.

  13. #13

    Re: The code in this projection must exist updated for apply on 64-chip systems

    Hi Rory

    Appreciate your response. I downloaded and unzipped the File. Unfortunately information technology won't open on my excel 32 fleck (no fault...but will non open) so I cannot see the changes you lot've fabricated. My Daughter will be dorsum in boondocks effectually Dec 12...she has 64 Bit Excel...we'll try it on her machine and I'll permit you lot know.
    John


  14. #14

    Re: The code in this projection must be updated for use on 64-bit systems

    Did you unblock the file? (right click information technology in Explore, cull Properties, then Unblock.)

  15. #fifteen

    Re: The code in this project must be updated for use on 64-fleck systems

    @ Rory
    That did it...I can now open the File in my 32 Bit Excel...now I need to effigy out what y'all modified...tin can yous give me a clue or three?

  16. #16

    Re: The code in this projection must be updated for use on 64-chip systems

    Quote Originally Posted by jaslake View Post

    @ Rory
    That did information technology...I can at present open the File in my 32 Bit Excel...at present I need to figure out what you modified...can you give me a clue or three?

    H Rory...it appears the bulk of your changes were in the Declare Statements...I compared mine to yours and I see the meaning changes you lot made...I simply don't know why. Were at that place other areas yous fabricated changes...if so...please refer me to them.

    Your Code appears to run fine on my Platform (32 Bit Excel). We will test information technology on my Daughters 64 Bit Excel Platform later in the month.
    Thanks for your help.


  17. #17

    Re: The code in this project must exist updated for use on 64-bit systems

    Information technology was the Declare statements (you don't just change all Long variables to LongPtr, information technology depends on what they are) and a couple of variables that were passed to/from those API functions. I also tidied up a couple of your combobox loading routines in passing.

  18. #18

    Re: The code in this project must be updated for use on 64-bit systems

    Hi Rory

    If y'all don't mind I'll go on this open until nosotros can test information technology on my Girl's platform (mid Dec). I've sent her the Code and she get'due south the fault message "Compile fault: can't find project or library". I know what that entails only I demand to be in forepart of her machine to prepare it. I know we could use TeamViewer or some such...I'd rather be looking at her platform and that's but a bit over a week away. I'll go back to yous...Cheers over again.
    John


  19. #19

    Re: The code in this project must be updated for use on 64-bit systems

    No problem - I'grand sure I'll exist effectually.

  20. #20

    Re: The code in this projection must exist updated for use on 64-fleck systems

    Howdy Rory
    I've not even so tested this on my Daughter's platform. I have purchased Excel 2019 and made a LOT of mods to my organisation.
    Modifications made to my platform (Office 2010):
    • Deleted Excel 2010 (32 Bit)
    • Restarted Figurer
    • Deleted Excel 2007 (32 Bit), Word 2007 (32 Bit) and Outlook 2007 (32 Chip)
    • Restarted Computer
    • Installed Excel 2019 (64 Bit)

    Opened Excel 2019 and my Girl's File, prepare References in her File as appropriate (a majestic pain).
    Got the aforementioned bulletin "The Code in this Projection must be updated to use on 64-scrap systems..."
    It was blowing out here...
    If I comment out this Code (equally you can run across I've done) the Code appears to run as required. Now, I can fly without this as this is a Family projection and I'm only a Call/Email/Text/300 to 500 miles away.
    However, do you lot accept a "quick gear up" to this block of Code? If so I'd appreciate information technology.

    In the concurrently I need to figure out how to go back the stuff I've modified...truly appreciate your help.
    John


  21. #21

    Re: The code in this project must be updated for utilise on 64-scrap systems

    Not sure how I missed that ane. It should read:

  22. #22

    Re: The code in this project must be updated for use on 64-bit systems

    Cheers Rory...did limited testing tonight...seems to practise as required on my platform.
    My Daughter will be at my identify with her platform about mid-month and we'll transfer the Files with Code to her 365 Excel...I'1000 assuming it'south going to piece of work.
    I truly appreciate your assistance.
    John

  23. #23

    Re: The lawmaking in this project must be updated for use on 64-bit systems

    No worries, John - fingers crossed all goes well.

  24. #24

    Re: The lawmaking in this project must be updated for use on 64-bit systems

    This is John's daughter. Cheers, Rory! Your excel fix worked!!!!!

    Have a fantastic end to 2019, and a wonderful commencement to 2020!


  25. #25

    Re: The code in this projection must be updated for use on 64-chip systems

    Hi Rory

    The Code transferred wonderfully well to my Daughters Excel 365. I truly appreciate your help...as does my Daughter.
    Give thanks you...Reputation added...Thank you, Give thanks You

    Last edited by jaslake; 12-12-2019 at 07:48 PM.

  26. #26

    Re: The code in this project must exist updated for use on 64-bit systems

    Quote Originally Posted by jaslake View Post

    This is John's daughter. Thank you, Rory! Your excel fix worked!!!!!

    Have a fantastic finish to 2019, and a wonderful beginning to 2020!

    Glad to assistance, and merry Christmas!

meltonpandrear.blogspot.com

Source: https://www.excelforum.com/excel-programming-vba-macros/1297489-the-code-in-this-project-must-be-updated-for-use-on-64-bit-systems.html

0 Response to "Please Review and Update Declare Statements and Then Mark Them With the Ptrsafe"

Publicar un comentario

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel