Results 1 to 3 of 3

Thread: [RESOLVED] [Excel] Detecting Excel Version with VBA

  1. #1

    Thread Starter
    Lively Member datapard's Avatar
    Join Date
    May 2008
    Location
    Silicon Valley, CA
    Posts
    107

    Resolved [RESOLVED] [Excel] Detecting Excel Version with VBA

    Is there a way to detect which version of Excel is running from within a Macro?

    What I need to do it get some code to run in both 2003 and 2007. Problem is that at least two sections of the code won't run in one version or the other, so I need to detect which version it is to get the code to run properly.

    example:

    if Excel2007 then
    2007 code runs here
    else
    2003 code runs here
    end if

    Any suggestions?

    Thanks
    datapard
    If you have to do it more than once...
    Automate it!

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [Excel] Detecting Excel Version with VBA

    application.version
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Lively Member datapard's Avatar
    Join Date
    May 2008
    Location
    Silicon Valley, CA
    Posts
    107

    Re: [Excel] Detecting Excel Version with VBA

    Quote Originally Posted by westconn1 View Post
    application.version
    Thanks westconn1. Do you happen to know what the designators for 2003 and 2007 are?

    Thanks again,
    datapard

    Edited:

    Never mind, I just found the answer. Thank you for your assistance.

    datapard
    Last edited by datapard; Jul 15th, 2009 at 11:07 PM.
    If you have to do it more than once...
    Automate it!

Posting Permissions

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



Click Here to Expand Forum to Full Width