{"id":6814,"date":"2016-03-16T12:54:06","date_gmt":"2016-03-16T03:54:06","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6814"},"modified":"2016-03-16T12:54:06","modified_gmt":"2016-03-16T03:54:06","slug":"excel-vbapowerpoint%e3%81%ab%e8%a1%a8%e3%82%92%e8%b2%bc%e3%82%8a%e4%bb%98%e3%81%91%e3%82%88%e3%81%86%e3%81%a8%e3%81%99%e3%82%8b%e3%81%a8%e3%82%aa%e3%83%bc%e3%83%88%e3%83%a1%e3%83%bc%e3%82%b7","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6814","title":{"rendered":"[Excel VBA]PowerPoint\u306b\u8868\u3092\u8cbc\u308a\u4ed8\u3051\u3088\u3046\u3068\u3059\u308b\u3068\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc\u304c\u767a\u751f"},"content":{"rendered":"<p>Excel Q&#038;A\u30b5\u30ed\u30f3(VBA)\u306b<a href=\"http:\/\/excelfactory.net\/excelboard\/excelvba\/excel.cgi?mode=all&#038;namber=175054&#038;rev=0\" title=\"Excel Q&#038;A\u30b5\u30ed\u30f3(VBA)\" target=\"_blank\">Excel\u306e\u8868\u3092PowerPoint\u306e\u30b9\u30e9\u30a4\u30c9\u306b\u8cbc\u308a\u4ed8\u3051\u3088\u3046\u3068\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b<\/a>\u3001\u3068\u306e\u8cea\u554f\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u4e0b\u8a18\u30b3\u30fc\u30c9\u3092PowerPoint 2010\u74b0\u5883\u3067\u5b9f\u884c\u3057\u3066\u52d5\u4f5c\u3092\u78ba\u8a8d\u3057\u3066\u307f\u308b\u3068\u3001\u305f\u3057\u304b\u306b\u4e00\u90e8\u306e\u5f62\u5f0f\u3067<span style=\"color: #ff0000; font-weight: bold;\">\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30a8\u30e9\u30fc(-2147188160 (80048240))<\/span>\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Public Sub Sample1()\r\n  Dim prs As Object\r\n  Dim lay As Object\r\n  \r\n  Const ppPasteDefault = 0\r\n  Const ppPasteBitmap = 1\r\n  Const ppPasteEnhancedMetafile = 2\r\n  Const ppPasteMetafilePicture = 3\r\n  Const ppPasteGIF = 4\r\n  Const ppPasteJPG = 5\r\n  Const ppPastePNG = 6\r\n  Const ppPasteText = 7\r\n  Const ppPasteHTML = 8\r\n  Const ppPasteRTF = 9\r\n  Const ppPasteOLEObject = 10\r\n  Const ppPasteShape = 11\r\n  \r\n  ActiveSheet.Range(&quot;B2:D7&quot;).Copy\r\n  With CreateObject(&quot;PowerPoint.Application&quot;)\r\n    .Visible = True\r\n    Set prs = .Presentations.Add\r\n    Set lay = GetCustomLayout(prs, &quot;\u767d\u7d19&quot;)\r\n    If Not lay Is Nothing Then\r\n      With prs.Slides.AddSlide(1, lay).Shapes\r\n        .PasteSpecial ppPasteDefault '\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30a8\u30e9\u30fc(-2147188160 (80048240))\r\n        '.PasteSpecial ppPasteBitmap 'OK\r\n        '.PasteSpecial ppPasteEnhancedMetafile 'OK\r\n        '.PasteSpecial ppPasteMetafilePicture 'OK\r\n        '.PasteSpecial ppPasteGIF '\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30a8\u30e9\u30fc(-2147188160 (80048240))\r\n        '.PasteSpecial ppPasteJPG '\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30a8\u30e9\u30fc(-2147188160 (80048240))\r\n        '.PasteSpecial ppPastePNG '\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30a8\u30e9\u30fc(-2147188160 (80048240))\r\n        '.PasteSpecial ppPasteText 'OK\r\n        '.PasteSpecial ppPasteHTML '\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30a8\u30e9\u30fc(-2147188160 (80048240))\r\n        '.PasteSpecial ppPasteRTF 'OK\r\n        '.PasteSpecial ppPasteOLEObject 'OK\r\n        '.PasteSpecial ppPasteShape '\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3 \u30a8\u30e9\u30fc(-2147188160 (80048240))\r\n      End With\r\n    End If\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Function GetCustomLayout(ByVal TargetPresentation As Object, _\r\n                                 ByVal LayoutName As String) As Object\r\n  Dim ret As Object\r\n  Dim c As Object\r\n  \r\n  For Each c In TargetPresentation.SlideMaster.CustomLayouts\r\n    If c.Name = LayoutName Then\r\n      Set ret = c\r\n      Exit For\r\n    End If\r\n  Next\r\n  Set GetCustomLayout = ret\r\nEnd Function<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerPoint_PasteSpecial_Error_01.jpg\" alt=\"PowerPoint_PasteSpecial_Error_01\" width=\"350\" height=\"214\" class=\"alignnone size-full wp-image-6815\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerPoint_PasteSpecial_Error_01.jpg 350w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerPoint_PasteSpecial_Error_01-300x183.jpg 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><\/p>\n<p>\u5f15\u3063\u639b\u304b\u308b\u306e\u306f\u4e00\u90e8\u306eDataType\u3067\u3001\u3055\u3089\u306b\u624b\u4f5c\u696d\u3067\u8cbc\u308a\u4ed8\u3051\u4f5c\u696d\u3092\u884c\u3046\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u306a\u3044\u306e\u3067\u3001\u4e0d\u53ef\u89e3\u306a\u52d5\u4f5c\u306b\u601d\u3048\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u624b\u4f5c\u696d\u3067\u554f\u984c\u304c\u7121\u3044\u306e\u3067\u3042\u308c\u3070\u3001\u4e0b\u8a18\u30b3\u30fc\u30c9\u306e\u3088\u3046\u306b\u76f4\u63a5\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c(ExecuteMso)\u3059\u308b\u3053\u3068\u3067\u3001\u30a8\u30e9\u30fc\u3092\u56de\u907f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Public Sub Sample2()\r\n  Dim prs As Object\r\n  Dim sld As Object\r\n  Dim lay As Object\r\n  Dim r As Object, c As Object\r\n  \r\n  ActiveSheet.Range(&quot;B2:D7&quot;).Copy\r\n  With CreateObject(&quot;PowerPoint.Application&quot;)\r\n    .Visible = True\r\n    Set prs = .Presentations.Add\r\n    Set lay = GetCustomLayout(prs, &quot;\u767d\u7d19&quot;)\r\n    If Not lay Is Nothing Then\r\n      Set sld = prs.Slides.AddSlide(1, lay)\r\n      .CommandBars.ExecuteMso &quot;PasteSourceFormatting&quot;\r\n      \r\n      With sld\r\n        '\u8cbc\u308a\u4ed8\u3051\u5f85\u3061\r\n        While .Shapes.Count &lt; 1\r\n          DoEvents\r\n        Wend\r\n        '----- \u4ee5\u4e0b\u88c5\u98fe -----\r\n        With .Shapes.Range(.Shapes.Count)\r\n          .Width = 640\r\n          .Height = 480\r\n          .Align msoAlignCenters, True '\u5de6\u53f3\u4e2d\u592e\u63c3\u3048\r\n          .Align msoAlignMiddles, True '\u4e0a\u4e0b\u4e2d\u592e\u63c3\u3048\r\n          If .HasTable = True Then\r\n            '\u5404\u30bb\u30eb\u306e\u30d5\u30a9\u30f3\u30c8\u30b5\u30a4\u30ba\u5909\u66f4\r\n            For Each r In .Table.Rows\r\n              For Each c In r.Cells\r\n                c.Shape.TextFrame2.TextRange.Font.Size = 24\r\n              Next\r\n            Next\r\n          End If\r\n        End With\r\n        '--------------------\r\n      End With\r\n    End If\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Function GetCustomLayout(ByVal TargetPresentation As Object, _\r\n                                 ByVal LayoutName As String) As Object\r\n  Dim ret As Object\r\n  Dim c As Object\r\n  \r\n  For Each c In TargetPresentation.SlideMaster.CustomLayouts\r\n    If c.Name = LayoutName Then\r\n      Set ret = c\r\n      Exit For\r\n    End If\r\n  Next\r\n  Set GetCustomLayout = ret\r\nEnd Function<\/pre>\n<p>\u4e0a\u8a18ExecuteMso\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u3067\u3042\u308b\u30b3\u30f3\u30c8\u30ed\u30fc\u30ebID(PasteSourceFormatting(\u5143\u306e\u66f8\u5f0f\u3092\u4fdd\u6301)\u3001PasteAsEmbedded(\u57cb\u3081\u8fbc\u307f)\u3001PasteExcelTableDestinationTableStyle(\u8cbc\u308a\u4ed8\u3051\u5148\u306e\u30b9\u30bf\u30a4\u30eb\u3092\u4f7f\u7528)\u7b49)\u306f\u4e0b\u8a18\u30ea\u30f3\u30af\u5148\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3001\u30b3\u30f3\u30c8\u30ed\u30fc\u30ebID\u30ea\u30b9\u30c8\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/docs.com\/c\/e\/office-id_CMWUZJSdWhgkmcAAhIHJhcw%7eM9b7eaf89-3923-5502-6256-a21acb30fe8d?v=1\" frameborder=\"0\" scrolling=\"no\" width=\"425px\" height=\"465px\" style=\"max-width:100%\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"Excel Q&#038;A\u30b5\u30ed\u30f3(VBA)\u306bExcel\u306e\u8868\u3092PowerPoint\u306e\u30b9\u30e9\u30a4\u30c9\u306b\u8cbc\u308a\u4ed8\u3051\u3088\u3046\u3068\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3001\u3068\u306e\u8cea\u554f\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u4e0b\u8a18\u30b3\u30fc\u30c9\u3092PowerPoint 2010\u74b0\u5883\u3067\u5b9f\u884c\u3057\u3066\u52d5\u4f5c\u3092\u78ba [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[[Excel VBA]PowerPoint\u306b\u8868\u3092\u8cbc\u308a\u4ed8\u3051\u3088\u3046\u3068\u3059\u308b\u3068\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3\u30a8\u30e9\u30fc\u304c\u767a\u751f]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48,58],"tags":[],"class_list":["post-6814","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-powerpoint"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1LU","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6814"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6814\/revisions"}],"predecessor-version":[{"id":6816,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6814\/revisions\/6816"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}