advanced help
per page, with , order by , clip by
Results of 1 - 1 of about 4502 for 条件付き書式 (0.007 sec.)
[[20230418162302]]
#score: 3708
@digest: be172f7884a59537faa154006f65e3d1
@id: 94045
@mdate: 2023-04-18T08:13:56Z
@size: 3863
@type: text/plain
#keywords: exportrange2 (43608), picname2 (42959), picname3 (42959), filesize (39991), exportrange3 (36340), filelen (19903), picname (18910), appearance (15943), chartobject3 (15497), nextsheet (15241), xlpicture (14778), copypicture (14734), xlscreen (14325), export (9226), pic (9200), 折エ (7748), 章: (7380), 各範 (5961), chart (5807), 回バ (5069), 定確 (4113), chartobjects (3479), 時折 (2859), wait (2765), image (2680), ーハ (2622), ハム (2611), timevalue (2319), ー10 (1543), 確率 (1245), ー時 (1123), ケジ (1007)
『実行時エラー 1004 rangeクラスのcopypictureメソッドが失敗しました。と一定確率で出るのを何とかしたい』(ブルーハム)
ほとんどが実行できますが時折エラーが出て中断されます。 エラー時の文章:実行時エラー 1004 rangeクラスのcopypictureメソッドが失敗しました。 エラーが起きる場所も毎回バラバラで、本来はタスクスケジューラで毎時自動で実行したいものなのでエラーが何とか起きないようにしたいです。 エラーが起きる場所は主に各範囲のpic.Chart.Pasteか、 各範囲それぞれのexportRange2.CopyPicture Appearance:=xlScreen, Format:=xlPicture この部分です。 助けてほしいですお願いします。 追伸:本来は範囲11まである分ですが文章の量的に範囲3以降は削除しています。もしかしたら消し忘れている部分があるかもしれないので、あったら申し訳ないです。 Private Sub Workbook_Open() Dim FileSize As Long Dim pic As ChartObject Dim picName As String Dim picName2 As String Dim picName3 As String Dim rng As Range Dim exportRange2 As Range Dim exportRange3 As Range Dim wb As Workbook: Set wb = ThisWorkbook Dim ws As Worksheet Dim path As String Dim retryCounter As Integer path = "C:¥???¥???¥???¥???¥???¥???¥" Application.DisplayAlerts = False Application.ScreenUpdating = False For Each ws In Worksheets Select Case ws.Name Case "報告書" picName = path & "image" & "1.png" Set rng = ws.Range("D4:N52") Application.Wait (Now + TimeValue("0:00:01")) rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture Set pic = ws.ChartObjects.Add(0, 0, rng.Width, rng.Height) pic.Name = "ChartObject3" pic.Chart.Export picName FileSize = FileLen(picName) If FileLen(picName) <= FileSize Then pic.Chart.Paste pic.Chart.Export picName End If pic.Delete Set pic = Nothing Case "グラフ" '範囲1 picName2 = path & "image" & "2.png" Set exportRange2 = ws.Range("A1:Y35") Application.Wait (Now + TimeValue("0:00:01")) exportRange2.CopyPicture Appearance:=xlScreen, Format:=xlPicture Set pic = ws.ChartObjects.Add(0, 0, exportRange2.Width, exportRange2.Height) pic.Name = "ChartObject2" pic.Chart.Export picName2 FileSize = FileLen(picName2) If FileLen(picName2) <= FileSize Then pic.Chart.Paste pic.Chart.Export picName2 End If pic.Delete Set pic = Nothing '範囲2 picName3 = path & "image" & "3.png" Set exportRange3 = ws.Range("A36:Y70") Application.Wait (Now + TimeValue("0:00:01")) exportRange3.CopyPicture Appearance:=xlScreen, Format:=xlPicture Set pic = ws.ChartObjects.Add(0, 0, exportRange3.Width, exportRange3.Height) pic.Name = "ChartObject3" pic.Chart.Export picName3 FileSize = FileLen(picName3) If FileLen(picName3) <= FileSize Then pic.Chart.Paste pic.Chart.Export picName3 End If pic.Delete Set pic = Nothing Case Else GoTo NextSheet End Select NextSheet: Next ws ThisWorkbook.Save Application.DisplayAlerts = True Application.ScreenUpdating = True Application.Quit End Sub < 使用 Excel:Excel2010、使用 OS:Windows10 > ---- なんでWaitなのかな、しかもコピーする前に と思った。 ただそう思っただけ。 (ジョア) 2023/04/18(火) 17:13:56 ...
http://www.excel.studio-kazu.jp/wiki/kazuwiki/202304/20230418162302.txt - [detail] - similar
PREV NEXT
Powered by Hyper Estraier 1.4.13, with 97032 documents and 608010 words.

訪問者:カウンタValid HTML 4.01 Transitional