{"id":4638,"date":"2024-02-02T16:58:34","date_gmt":"2024-02-02T16:58:34","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/wp\/?p=4638"},"modified":"2024-02-02T16:58:34","modified_gmt":"2024-02-02T16:58:34","slug":"how-to-get-excel-version-using-vba-code","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/","title":{"rendered":"How to Get Excel version using VBA Code"},"content":{"rendered":"

Dear Friends,<\/p>\n

Usually while working on any of the VBA projects, it becomes important for me to first check the version of excel which user is using and based on that certain functionality of my tool may or may not work. For Example: If you have some sales data using more than 256 columns then if user is using Excel 2003, then it would not be possible as Excel 2003 has got only 256 columns. But if user is using any higher version like Excel 2007 etc. then it is possible to do so without any error as they have got 16000+ columns in it. This way before processing the data if you can identify the version of the excel user is using then you will be able to handle the error without crashing the excel.<\/p>\n

As user I would always prefer a clear message stating that “this functionality is not available in so and so Excel version” rather than getting some weird Microsoft error message and messing up other functionalities as well.<\/p>\n

It is a very simple piece of code which will determine which version of excel user is using. Whenever you call the bellow function at any moment of time when it is necessary to check the version of the excel.<\/p>\n

\nFunction GetVersion() As String\n    Dim verNo As Integer\n    verNo = VBA.Val(Application.Version)\n    Select Case verNo\n        Case 8:\n        GetVersion = \"Excel 97\"\n        Case 9:\n        GetVersion = \"Excel 2000\"\n        Case 10:\n        GetVersion = \"Excel 2002\"\n        Case 11:\n        GetVersion = \"Excel 2003\"\n        Case 12:\n        GetVersion = \"Excel 2007\"\n        Case 14:\n        GetVersion = \"Excel 2010\"\n        Case 15:\n        GetVersion = \"Excel 2013\"\n        Case 16:\n        GetVersion = \"Excel 2016\"\n        Case Else:\n        GetVersion= \"Excel Unknown Version\u201d\n    End Select\nEnd Function\n<\/code><\/pre>\n

Important Note: <\/h3>\n

VBA.Val(Application.Version) returns a number. Each version of the excel can be determined by the following mapping of Version Number and name. Same mapping I have put in the above code:
\n 
\nDo not ask me why version number 13 is missing from the sequence \ud83d\ude42
\n <\/p>\n\n\n\n\n\n\n\n\n\n\n\n
Version Number<\/td>\nVersion Name<\/td>\n<\/tr>\n
8<\/td>\nExcel 97<\/td>\n<\/tr>\n
9<\/td>\nExcel 2000<\/td>\n<\/tr>\n
10<\/td>\nExcel 2002<\/td>\n<\/tr>\n
11<\/td>\nExcel 2003<\/td>\n<\/tr>\n
12<\/td>\nExcel 2007<\/td>\n<\/tr>\n
14<\/td>\nExcel 2010<\/td>\n<\/tr>\n
15<\/td>\nExcel 2013<\/td>\n<\/tr>\n
16<\/td>\nExcel 2016<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

How to use this function? <\/h3>\n

Step 1. Copy the above code
\nStep 2. Create a publich module in your VBA project
\nStep 3. Paste this code there
\nStep 4. Now you are ready to call this function anywhere in your workbook
\nyou can also call this function from you excel cell as a formula and it will return the version of the excel you are using currently.
\nEnjoy writing full proof VBA code without any unknown error related to excel version. Keep looking in this space for many more such small tips and tricks in VBA.<\/p>\n

Have a nice weekend !!<\/p>\n<\/span>","protected":false},"excerpt":{"rendered":"

Dear Friends, Usually while working on any of the VBA projects, it becomes important for me to first check the version of excel which user is using and based on that certain functionality of my tool may or may not work. For Example: If you have some sales data using more than 256 columns then […]<\/p>\n","protected":false},"author":45,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1246,1674,1679,1675,1676],"tags":[],"yoast_head":"\nGet Microsoft Excel version using Excel Macro<\/title>\n<meta name=\"description\" content=\"VBA code to get excel version which user is using. Lit of all the excel version number and name mapping is provided in this article. Macro to get the Excel version.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Get Excel version using VBA Code\" \/>\n<meta property=\"og:description\" content=\"VBA code to get excel version which user is using. Lit of all the excel version number and name mapping is provided in this article. Macro to get the Excel version.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Let's excel in Excel\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/vmlogger\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-02T16:58:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/vmlogger.com_-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vishwamitra Mishra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/www.twitter.com\/learnexcelmacro\" \/>\n<meta name=\"twitter:site\" content=\"@learnexcelmacro\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vishwamitra Mishra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/\"},\"author\":{\"name\":\"Vishwamitra Mishra\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"headline\":\"How to Get Excel version using VBA Code\",\"datePublished\":\"2024-02-02T16:58:34+00:00\",\"dateModified\":\"2024-02-02T16:58:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/\"},\"wordCount\":372,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"articleSection\":[\"Excel Macro\",\"Excel Macro Basics\",\"Excel Macro Beginner\",\"Excel Macro Tutorial\",\"Excel Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/\",\"name\":\"Get Microsoft Excel version using Excel Macro\",\"isPartOf\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\"},\"datePublished\":\"2024-02-02T16:58:34+00:00\",\"dateModified\":\"2024-02-02T16:58:34+00:00\",\"description\":\"VBA code to get excel version which user is using. Lit of all the excel version number and name mapping is provided in this article. Macro to get the Excel version.\",\"breadcrumb\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/vmlogger.com\/excel\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Excel Macro\",\"item\":\"https:\/\/vmlogger.com\/excel\/macro\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Get Excel version using VBA Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#website\",\"url\":\"https:\/\/vmlogger.com\/excel\/\",\"name\":\"Let's excel in Excel\",\"description\":\"Let's share knowledge\",\"publisher\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/vmlogger.com\/excel\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5\",\"name\":\"Vishwamitra Mishra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"contentUrl\":\"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png\",\"width\":528,\"height\":560,\"caption\":\"Vishwamitra Mishra\"},\"logo\":{\"@id\":\"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/\"},\"description\":\"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.\",\"sameAs\":[\"http:\/\/www.learnexcelmacro.com\",\"http:\/\/www.facebook.com\/vmlogger\",\"https:\/\/twitter.com\/https:\/\/www.twitter.com\/learnexcelmacro\",\"https:\/\/www.youtube.com\/c\/VMLogger\"],\"url\":\"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Get Microsoft Excel version using Excel Macro","description":"VBA code to get excel version which user is using. Lit of all the excel version number and name mapping is provided in this article. Macro to get the Excel version.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/","og_locale":"en_US","og_type":"article","og_title":"How to Get Excel version using VBA Code","og_description":"VBA code to get excel version which user is using. Lit of all the excel version number and name mapping is provided in this article. Macro to get the Excel version.","og_url":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/","og_site_name":"Let's excel in Excel","article_publisher":"http:\/\/www.facebook.com\/vmlogger","article_author":"http:\/\/www.facebook.com\/vmlogger","article_published_time":"2024-02-02T16:58:34+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/vmlogger.com_-1.png","type":"image\/png"}],"author":"Vishwamitra Mishra","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/www.twitter.com\/learnexcelmacro","twitter_site":"@learnexcelmacro","twitter_misc":{"Written by":"Vishwamitra Mishra","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#article","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/"},"author":{"name":"Vishwamitra Mishra","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"headline":"How to Get Excel version using VBA Code","datePublished":"2024-02-02T16:58:34+00:00","dateModified":"2024-02-02T16:58:34+00:00","mainEntityOfPage":{"@id":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/"},"wordCount":372,"commentCount":4,"publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"articleSection":["Excel Macro","Excel Macro Basics","Excel Macro Beginner","Excel Macro Tutorial","Excel Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/","url":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/","name":"Get Microsoft Excel version using Excel Macro","isPartOf":{"@id":"https:\/\/vmlogger.com\/excel\/#website"},"datePublished":"2024-02-02T16:58:34+00:00","dateModified":"2024-02-02T16:58:34+00:00","description":"VBA code to get excel version which user is using. Lit of all the excel version number and name mapping is provided in this article. Macro to get the Excel version.","breadcrumb":{"@id":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vmlogger.com\/excel\/2024\/02\/how-to-get-excel-version-using-vba-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vmlogger.com\/excel\/"},{"@type":"ListItem","position":2,"name":"Excel Macro","item":"https:\/\/vmlogger.com\/excel\/macro\/"},{"@type":"ListItem","position":3,"name":"How to Get Excel version using VBA Code"}]},{"@type":"WebSite","@id":"https:\/\/vmlogger.com\/excel\/#website","url":"https:\/\/vmlogger.com\/excel\/","name":"Let's excel in Excel","description":"Let's share knowledge","publisher":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vmlogger.com\/excel\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/7500a107b0b2d35a8492acf0d11fc8e5","name":"Vishwamitra Mishra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/","url":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","contentUrl":"https:\/\/vmlogger.com\/excel\/wp-content\/uploads\/sites\/11\/2022\/07\/avataaars-1.png","width":528,"height":560,"caption":"Vishwamitra Mishra"},"logo":{"@id":"https:\/\/vmlogger.com\/excel\/#\/schema\/person\/image\/"},"description":"My name is Vishwamitra Mishra. Friends Call me Vishwa. I hold a Bachelor\u2019s Degree in Computer Science from D.A.V.V. Indore & currently working as a Technical Lead having over 7 years of experience.","sameAs":["http:\/\/www.learnexcelmacro.com","http:\/\/www.facebook.com\/vmlogger","https:\/\/twitter.com\/https:\/\/www.twitter.com\/learnexcelmacro","https:\/\/www.youtube.com\/c\/VMLogger"],"url":"https:\/\/vmlogger.com\/excel\/author\/vishwamitra\/"}]}},"_links":{"self":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/4638"}],"collection":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/users\/45"}],"replies":[{"embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/comments?post=4638"}],"version-history":[{"count":0,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/posts\/4638\/revisions"}],"wp:attachment":[{"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/media?parent=4638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/categories?post=4638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vmlogger.com\/excel\/wp-json\/wp\/v2\/tags?post=4638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}