{"id":81,"date":"2019-04-08T18:06:17","date_gmt":"2019-04-08T18:06:17","guid":{"rendered":"https:\/\/keithratner.live\/optionexplicit\/?p=81"},"modified":"2019-04-26T21:03:12","modified_gmt":"2019-04-26T21:03:12","slug":"elapsedtime","status":"publish","type":"post","link":"https:\/\/keithratner.live\/optionexplicit\/elapsedtime\/","title":{"rendered":"ElapsedTime"},"content":{"rendered":"<pre>Function ElapsedTime( _\r\n    endTime As Date, _\r\n    startTime As Date _\r\n) As String\r\n    Dim Interval As Date\r\n    ' Calculate the time interval.\r\n    Interval = endTime - startTime\r\n    ' Format and print the time interval in \r\n    ' days, hours, minutes and seconds.\r\n    ElapsedTime = _\r\n        Int( _\r\n            CSng( _\r\n                Interval _\r\n            ) _\r\n        ) &amp; _\r\n        \" days \" &amp; _\r\n        Format( _\r\n            Interval, _\r\n            \"hh\" _\r\n        ) &amp; _\r\n        \" Hours \" &amp; _\r\n        Format( _\r\n            Interval, _\r\n            \"nn\" _\r\n        ) &amp; _\r\n        \" Minutes \" &amp; _\r\n        Format( _\r\n            Interval, _\r\n            \"ss\" _\r\n        ) &amp; _\r\n        \" Seconds\"\r\nEnd Function<\/pre>\n<p>This has been adapted from <a href=\"https:\/\/docs.microsoft.com\/en-us\/office\/vba\/access\/concepts\/date-time\/calculate-elapsed-time\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/docs.microsoft.com\/en-us\/office\/vba\/access\/concepts\/date-time\/calculate-elapsed-time<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Function ElapsedTime( _ endTime As Date, _ startTime As Date _ ) As String Dim Interval As Date &#8216; Calculate the time interval. Interval = endTime &#8211; startTime &#8216; Format and print the time interval in &#8216; days, hours, minutes and seconds. ElapsedTime = _ Int( _ CSng( _ Interval _ ) _ ) &amp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":107,"comment_status":"open","ping_status":"open","sticky":false,"template":"page-templates\/full-width-no-post-thumbnail.php","format":"standard","meta":{"inline_featured_image":false,"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,4,6,3],"tags":[],"class_list":["post-81","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","category-distribution","category-snippets","category-vba"],"krwpengineoptions-featuredonwpengineblog":"","jetpack_featured_media_url":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2019\/04\/elapsedtime.png?fit=309%2C480&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pgsIIA-1j","jetpack-related-posts":[{"id":316,"url":"https:\/\/keithratner.live\/optionexplicit\/the-importance-of-visual-basic-for-applications-vba\/","url_meta":{"origin":81,"position":0},"title":"The Importance of Visual Basic for Applications (VBA)","author":"Keith","date":"March 23, 2023","format":false,"excerpt":"Visual Basic for Applications (VBA) is a programming language that is used to automate tasks in Microsoft Office applications, including Excel, Word, and PowerPoint. VBA allows users to create customized macros, automate repetitive tasks, and interface with external software, making it an essential part of many businesses' software workflows. In\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/keithratner.live\/optionexplicit\/category\/articles\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":319,"url":"https:\/\/keithratner.live\/optionexplicit\/why-object-oriented-vba\/","url_meta":{"origin":81,"position":1},"title":"Why Object-Oriented VBA?","author":"Keith","date":"March 23, 2023","format":false,"excerpt":"\"Object-oriented programming is an essential concept in modern software engineering that encapsulates data and functionality within a single entity called an object. Microsoft's Visual Basic for Applications (VBA) is a popular programming language used in creating software for Microsoft Office applications like Excel and PowerPoint. Although VBA has its roots\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/keithratner.live\/optionexplicit\/category\/articles\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":965,"url":"https:\/\/keithratner.live\/optionexplicit\/export-vba-modules-for-version-control\/","url_meta":{"origin":81,"position":2},"title":"Export VBA Modules for Version Control updated September 2024","author":"Keith","date":"September 26, 2024","format":false,"excerpt":"Add a Module in your VBA Project. Name it \"Exports\" and paste the following code into the module in its entirety. When your project is ready for export (and subsequent version control), click on the \"Macros\" button in the Developer ribbon, select \"ExportVBAModules\" and click \"Run.\" Option Explicit ' Define\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/keithratner.live\/optionexplicit\/category\/articles\/"},"img":{"alt_text":"Exports Module","src":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2024\/09\/exports-module.png?fit=885%2C424&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2024\/09\/exports-module.png?fit=885%2C424&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2024\/09\/exports-module.png?fit=885%2C424&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2024\/09\/exports-module.png?fit=885%2C424&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":322,"url":"https:\/\/keithratner.live\/optionexplicit\/why-use-vba-in-excel\/","url_meta":{"origin":81,"position":3},"title":"Why Use VBA in Excel?","author":"Keith","date":"March 23, 2023","format":false,"excerpt":"Excel VBA, or Visual Basic for Applications, is a programming language that allows developers to automate tasks and build applications within the Excel environment. Utilizing Excel VBA can dramatically improve your productivity and increase your Excel skillset, as well as provide you with the opportunity to create customized macros for\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/keithratner.live\/optionexplicit\/category\/articles\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":563,"url":"https:\/\/keithratner.live\/optionexplicit\/update-access-vba-saved-imports-exports\/","url_meta":{"origin":81,"position":4},"title":"Update Access VBA Saved Imports Exports: A Step-by-Step Guide","author":"Keith","date":"May 3, 2024","format":false,"excerpt":"Updating Access VBA saved imports exports is essential when dealing with external data sources. This step-by-step guide will show you how to update Access VBA saved imports exports by dynamically changing the file path within your import\/export specifications. In this article, we'll walk through a powerful VBA script that allows\u2026","rel":"","context":"In &quot;Articles&quot;","block_context":{"text":"Articles","link":"https:\/\/keithratner.live\/optionexplicit\/category\/articles\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/keithratner.live\/optionexplicit\/wp-content\/uploads\/sites\/29\/2024\/05\/Screenshot-2024-05-03-133800.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":216,"url":"https:\/\/keithratner.live\/optionexplicit\/returnname\/","url_meta":{"origin":81,"position":5},"title":"ReturnName","author":"Keith","date":"September 11, 2019","format":false,"excerpt":"Function ReturnName(ByVal num As Integer) As String ReturnName = Split(Cells(, num).Address, \"$\")(1) End Function","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/keithratner.live\/optionexplicit\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/81","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/comments?post=81"}],"version-history":[{"count":3,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/81\/revisions"}],"predecessor-version":[{"id":109,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/posts\/81\/revisions\/109"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/media\/107"}],"wp:attachment":[{"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/media?parent=81"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/categories?post=81"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/keithratner.live\/optionexplicit\/wp-json\/wp\/v2\/tags?post=81"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}