+ Reply to Thread
Results 1 to 8 of 8

VBA API Call returns value when run on one computer but not on another identical one

  1. #1
    Registered User
    Join Date
    12-10-2013
    Location
    San Francisco, US
    MS-Off Ver
    Excel 2010
    Posts
    4

    VBA API Call returns value when run on one computer but not on another identical one

    I have an API call that returns a value from a foreign listview (Java application) that works just fine on my computer. When I try to run the same call on my colleague's computer, however, it just returns "0". We work in an office and our computers are identical--same model, same version of Windows, same version of MS Office (with Excel). The file with the API call resides on a shared network location, so it is the exact same file, exact same code that I am running on both machines. I am not very well-versed in API, so I'm probably missing something simple, but I haven't been able to solve it. Can anyone clue me in to why the code works on one machine but not the other?

    Here's the code with the call--see my NOTE about halfway down that shows where I get a discrepancy:

    Please Login or Register  to view this content.
    Thanks to anyone who might have some suggestions.
    Last edited by mbible; 12-10-2013 at 05:41 PM.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA API Call returns value when run on one computer but not on another identical one

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    BTW - What's the security setting on your colleague's computer??
    Last edited by xladept; 12-10-2013 at 04:16 PM.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    12-10-2013
    Location
    San Francisco, US
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: VBA API Call returns value when run on one computer but not on another identical one

    Thanks for the tip. This was my first post here.
    The security settings for our computers are controlled by our IT dept and I believe they are the same for both of us--we are not able to tinker with them on our own. If you think this may be the source of the problem, though, I can check.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA API Call returns value when run on one computer but not on another identical one

    Thanks for the code tags, I 'm curious what your IT might say

  5. #5
    Registered User
    Join Date
    12-10-2013
    Location
    San Francisco, US
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: VBA API Call returns value when run on one computer but not on another identical one

    When I asked them about it before, I framed it as a question about VBA and API and, unfortunately, they aren't familiar with that--they tend to focus more on the hardware side of it. I didn't think of the security settings issue. When you say "security settings" were you referring to the settings on the computer itself or the browser settings?
    Thanks
    MB

  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: VBA API Call returns value when run on one computer but not on another identical one

    Hello nibble,

    A process belongs to a thread. Windows only allows processes in the same thread to share the same memory space. This model is known as apartment threading.

    If the ListView object is created by Excel on the network server then that copy of Excel owns the ListView object. Only the thread that started the process can access the process' memory.

    The memory information can be made available to outside threads by using structures or global variables. The ListView object already does this for you.

    You code is confusing because the only handle you need to access the ListView from any other process is the window handle (hWnd). The hWnd property was made available in VBA6. There is no need to use the API to retrieve it, unless you are using older versions of VBA.
    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
    12-10-2013
    Location
    San Francisco, US
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: VBA API Call returns value when run on one computer but not on another identical one

    Thank you Leith Ross for your reply. It does not seem to address my particular issue, though. I am the first to admit that the code may be confusing and that there may be better ways of doing it, however it does work for me--it produces the result I'm looking for. My problem is that under what seem to be identical conditions, I can't get the very same code to run on another computer--that would suggest to me that it is not the code itself that is the problem, but it must be something about the computer that it is being run on. If it works on my or other computers, but does not work on still others, then something else is going on--something specific to the computer but I can't figure out what.

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA API Call returns value when run on one computer but not on another identical one

    I meant the security settings on the individual computer itself.

+ 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. Replies: 6
    Last Post: 06-28-2013, 08:44 PM
  2. [SOLVED] How do I call "My Computer" in a macro?
    By jlax34 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-08-2012, 11:28 AM
  3. Function call returns actual code instead of copied range
    By rlg50 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-22-2012, 04:44 PM
  4. Auto Filter on my home computer differs from my work computer.
    By Sbova0226 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-08-2009, 03:04 PM
  5. [SOLVED] No Returns on Fuction Call
    By PJohnson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2005, 12:06 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