Consulting

Results 1 to 9 of 9

Thread: 64-bit support

  1. #1

    64-bit support

    The time has come (without going into specifics) where I need to be supporting 64-bit Office, but also need to maintain compatibility back to Office 2003.

    Changing API declarations for Win32 libraries is straightforward, as is regular variable declaration within a procedure by using conditional compilation.. But what about declaring variables in the parameters of a function?

    ie

    Public Function MyFunction (lngLong1 as LongPtr, lngLong2 as LongPt)
    <some code>
    some.thing=lngLong1
    something.else=lngLong2
    <some code>
    End Function

    That will work fine on Office '10, but I have no option but to support Office 2003 (clients). How do I convert that to conditionally compile?

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Do be aware that 32-bit Addins will not work with 64-bit Office. For that reason, MS recommends only installing Office in 64-bit mode where really necessary (mostly to do with humungous Excel workbooks).
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Yes I agree, there aren't many situations where you'd install it - but as you've noted, the big Excel workbooks (and the extra capability that gives in terms of Powerpivot etc) are a big draw for some industry sectors. If a client deploys it, I have to support it.

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    You have to create two versions of the function and put both inside conditional compilation directives.
    Be as you wish to seem

  5. #5
    Ah okay, that's what I was afraid of! Not ideal, but no choice in this instance I think.

    Thanks!

  6. #6
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    Actually I just did a quick test and it seems you can simply make the declaration line conditional, though I think it may end up less confusing to create separate routines in most cases.
    Be as you wish to seem

  7. #7
    Quote Originally Posted by Aflatoon
    Actually I just did a quick test and it seems you can simply make the declaration line conditional, though I think it may end up less confusing to create separate routines in most cases.
    How did you structure that line? I tried something along those lines but couldn't get it to work... I suspect it was finger trouble, though

  8. #8
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    basically
    [vba]#If VBA7 Then
    Public Function Blah(args as LongPtr)
    #Else
    Public Function Blah(args as Long)
    #End If[/vba]
    Be as you wish to seem

  9. #9
    Ah yeah that works a treat, thanks!

Posting Permissions

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