From 81c9f6733170fa48b3a28651583553a409b1ab5b Mon Sep 17 00:00:00 2001 From: Kenichiro NOGI Date: Fri, 11 Sep 2026 14:20:30 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20D7=E5=88=87=E6=9B=BF=E3=82=92=E5=BB=83?= =?UTF-8?q?=E6=AD=A2=E3=81=97Export/Get=E4=B8=A1=E6=96=B9=E3=82=92?= =?UTF-8?q?=E6=AF=8E=E5=9B=9E=E5=AE=9F=E8=A1=8C=E3=80=81=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E5=85=88=E3=82=92tableId+E/G=E3=82=B7=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=81=AB=E5=88=86=E9=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit D7による方式切替をやめ、run()実行のたびにExport方式・Get方式を両方実行するよう変更。 Export結果は tableId&"E" シート、Get結果は tableId&"G" シートへ別々に保存。 両シートが分かれたため、Get→Export切替時のヘッダ残留対策(既存テーブル削除)は不要になり削除。 処理時間はD4〜D6に両方式合計で記録。 --- .../vba-files/Module/Module1.bas | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas b/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas index fa464929..919de8e7 100644 --- a/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas +++ b/XVBA/新版着工要因閲覧シート/vba-files/Module/Module1.bas @@ -6,7 +6,6 @@ Public baseURL As String Public yearFilter As String Public tableId As String Public defaultSh As Worksheet -Public fetchMethod As String Function init() 'Pleasanter API KEY @@ -15,7 +14,6 @@ Function init() tableId = Range("HvID") Set defaultSh = ThisWorkbook.Sheets("{") - fetchMethod = defaultSh.Range("D7").Value End Function '****************************************************************************** @@ -32,13 +30,10 @@ Sub run() '------------------------------------------ Debug.Print "Jn" - Dim success As Boolean - Select Case fetchMethod - Case "Get" - success = runGetFlow() - Case Else - success = runExportFlow() - End Select + Dim exportSuccess As Boolean + Dim getSuccess As Boolean + exportSuccess = runExportFlow() + getSuccess = runGetFlow() Debug.Print "I" '------------------------------------------ @@ -52,7 +47,7 @@ Cleanup: If Err.Number <> 0 Then defaultSh.Range("D3").Value = "捞siG[j: " & Err.Description Err.Clear - ElseIf Not success Then + ElseIf Not (exportSuccess And getSuccess) Then defaultSh.Range("D3").Value = "捞sif[^擾G[j" Else defaultSh.Range("D3").Value = "捞" @@ -72,12 +67,7 @@ Function runExportFlow() As Boolean Debug.Print "f[^擾ł܂ł" runExportFlow = False Else - 'Gets̃wb_\cĂꍇɔAe[u폜Ă蒼 - On Error Resume Next - ThisWorkbook.Sheets(tableId).ListObjects(tableId).Delete - On Error GoTo 0 - - Call exportCSVDataToSheet(resData, tableId) + Call exportCSVDataToSheet(resData, tableId & "E") runExportFlow = True End If End Function @@ -98,7 +88,7 @@ Function runGetFlow() As Boolean Debug.Print "f[^擾ł܂ł" runGetFlow = False Else - Call getRecordsDataToSheet(records, tableId) + Call getRecordsDataToSheet(records, tableId & "G") runGetFlow = True End If End Function