{"id":5067,"date":"2021-11-12T10:18:02","date_gmt":"2021-11-12T10:18:02","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=5067"},"modified":"2021-11-12T10:18:35","modified_gmt":"2021-11-12T10:18:35","slug":"vbs-script-open-file-run-macro-but-does-not-save-the-file","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/office\/vbs-script-open-file-run-macro-but-does-not-save-the-file\/19568.html","title":{"rendered":"VBS Script Open File, Run Macro But Does Not Save The File"},"content":{"rendered":"<p>Hi,<\/p>\n<p>I have the following vbs code that works great, but it doesn&#8217;t save the file after running the macro? Does anyone have any ideas how to fix this?<\/p>\n<p>&nbsp;<\/p>\n<pre>Option Explicit\r\n\r\nOn Error Resume Next\r\n\r\nExcelMacroExample\r\n\r\nSub ExcelMacroExample() \r\n\r\n  Dim xlApp \r\n  Dim xlBook \r\n\r\n  Set xlApp = CreateObject(\"Excel.Application\") \r\n  Set xlBook = xlApp.Workbooks.Open(\"G:\\Operations Excellence\\Forms\\ASA Forms\\Start-Stop\\Start-Stop by Plant-rev1.xlsm\", 0, True) \r\n  xlApp.Run \"RDB_Worksheet_Or_Worksheets_To_PDF_And_Create_Mail\"\r\n  xlApp.Save\r\n  xlApp.DisplayAlerts = False\r\n  xlApp.ActiveWorkbook.Close\r\n  xlApp.Quit \r\n\r\n  Set xlBook = Nothing \r\n  Set xlApp = Nothing \r\n\r\nEnd Sub<\/pre>\n<p>Thank you,<br \/>\nSandi<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":23},"question-category":[53],"question_tags":[],"class_list":["post-5067","question","type-question","status-publish","hentry","question-category-office"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/5067","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=5067"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=5067"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=5067"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=5067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}