{"id":4379,"date":"2021-11-10T09:48:10","date_gmt":"2021-11-10T09:48:10","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=4379"},"modified":"2021-11-10T09:48:28","modified_gmt":"2021-11-10T09:48:28","slug":"solved-mac-excel-macro-to-print-a-worksheet-as-pdf","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/office\/mac-excel-macro-to-print-a-worksheet-as-pdf\/21461.html","title":{"rendered":"Solved Mac Excel Macro To Print a Worksheet As PDF"},"content":{"rendered":"<p>Hi folks, I need to print Mac Excel sheet to PDF quite often, here are the VBA code used to be working fine with my Office 2011, but it does&#8217;t work in Office 2016\/2019, the macro is to print sheet to a fixed location, with file name format Invoice+sheet tab name, when I run the macro, it will highlight &#8220;PublishiOption:=, and says &#8220;Compile error: Name argument not found&#8221;, can anyone please tell me how to rectify it? thank you in advance<\/p>\n<p>Sub SaveInvoice()<\/p>\n<p>&#8216; SavePDF Macro<br \/>\n&#8216; Save sheet to PDF<br \/>\n&#8216;<br \/>\n&#8216; Keyboard Shortcut: Option+Cmd+e<br \/>\n&#8216;<br \/>\nActiveSheet.Copy<br \/>\nRange(&#8220;A1:J60&#8221;).Select<br \/>\nActiveWorkbook.SaveAs FileName:= _<br \/>\n&#8220;MBP2018:Users:Jackcai:Dropbox:Temp PDF:Invoice.pdf&#8221;, FileFormat:=xlPDF, _<br \/>\nPublishOption:=xlSheet<br \/>\nActiveWorkbook.Close (False)<br \/>\n&#8216;<br \/>\nEnd Sub<\/p>\n","protected":false},"author":1,"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-4379","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\/4379","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=4379"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=4379"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=4379"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=4379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}