3333

一系列VBScript脚本读取Excel文件中的特定工作表,根据预设规则生成SQL更新语句。脚本检查单元格颜色和内容,根据条件写入文本文件。涉及的数据处理包括不同工作表中的条件判断、颜色标识、值映射和循环操作,生成的SQL用于更新数据库中的设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

if(Wscript.Arguments.Count<3) then
 'msgbox "The count of Arguments is "&Wscript.Arguments.Count
 'Quit VBS script
 'Wscript.Quit
End if

msgbox "Vbs18_実行開始"

Set oExcel=CreateObject("excel.application")
Set fs = CreateObject("Scripting.FileSystemObject")
path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path

Set f=fs.OpenTextFile(path+"\bankCd.txt")
DO While f.AtEndOfStream <> True
 BankCode=f.ReadLine 
loop
f.close

Set oWorkBook=oExcel.Workbooks.Open(path+"\01.しんきん預ナビ設定シート_"+BankCode+".xlsx")

'use the worksheet "【別紙】2-①"
sheetNm = "【別紙】2-①"
Set oSheet=oWorkBook.Sheets(sheetNm)

'Get the used range
'Set Sheet = oExcel.Worksheets("Prop_Methods").UsedRange

Set a = fs.CreateTextFile(path+"\18_" + sheetNm + ".sql", True)
a.Close
' Read=1 Write=2 Append =8
Set a = fs.OpenTextFile(path+"\18_" + sheetNm + ".sql", 8, false)

'背景色常数:RGB(255,255,102)値
Const COLORCONST = 6750207


'we can write more value to the text file by using loop

Dim OriginRow:OriginRow = 48 '
Dim OriginCol:OriginCol = 3 '
testAnsert=oSheet.cells(OriginRow,OriginCol)
'Wscript.echo testAnsert

if testAnsert="条件" then 
'Wscript.echo oSheet.cells(OriginRow,OriginCol).Row
'Wscript.echo oSheet.cells(OriginRow,OriginCol).Column
end If

Dim DiffRow:DiffRow = OriginRow - 1 '
Dim DiffCol:DiffCol = OriginCol - 1
'Wscript.echo DiffRow '47
'Wscript.echo DiffCol '2

Dim Col:Col = 11 + DiffCol '

Dim Stp:Stp = 0 '

Do Until Stp = 12
  
  Col = Col + 7
  Stp = Stp + 1
  
Dim Row:Row = 4 + DiffRow '51
For k = 1 To 8 step 1
  
  Row = Row + 2
  AgeDivVal = 3
  If k > 4 then
    AgeDivVal = 4
  End If
  
  If (k mod 2) = 0 then
    SeatmateDivVal = 0
  else SeatmateDivVal = 1
  End If
  
  Select Case k
    Case 1, 2, 5, 6
        CanvassItemDivVal = 0
    Case 3, 4, 7, 8
        CanvassItemDivVal = 1
  End Select
  
  InsItemFlagVal = 0
  If Stp > 6 then
    InsItemFlagVal = 1
  End If
  
  Select Case Stp
    Case 1, 2, 3, 7, 8, 9
        TodayOrderFlgVal = 1
    Case 4, 5, 6, 10, 11, 12
        TodayOrderFlgVal = 0
  End Select


  Select Case (Stp mod 3)
    Case 0
        param = "BuyingInstructSheetPrintFlg" '★
    Case 1
        param = "ContractPossibleDiv"
    Case 2
        param = "OperatorDiv" '★
  End Select


  value=oSheet.cells(Row,Col)
  Select Case value
    Case "〇", "不要"
        Val = 0
    Case "×", "必要", "全て"
        Val = 1
    Case "役席"
        Val = 2
    Case "管理者"
        Val = 3
    Case Else
        Val= value '★
  End Select
  
  cellColor=oSheet.cells(Row,Col).DisplayFormat.Interior.Color
  If cellColor=COLORCONST then
   a.WriteLine "UPDATE M_ADVANCED_ORDER_CHECK SET "+  CStr(param) + " = " + "'" + CStr(Val) + "'" + ",LastUpdBankerNm = 'MAINTENANCE',LastUpdDateTime = CURRENT_TIMESTAMP WHERE AgeDiv = " + "'" + CStr(AgeDivVal) + "'" + " AND SeatmateDiv = " + "'" + CStr(SeatmateDivVal) + "'" + " AND CanvassItemDiv = " + "'" + CStr(CanvassItemDivVal) + "'" + " AND TodayOrderFlg = " + "'" + CStr(TodayOrderFlgVal) + "'" + " AND InsItemFlag = " + "'" + CStr(InsItemFlagVal) + "'" + ";"
  else
  End If

Next

Loop

a.Close


Set oSheet=Nothing 
oExcel.Quit

msgbox "Vbs18_実行終了"
=================================================================================
if(Wscript.Arguments.Count<3) then
 'msgbox "The count of Arguments is "&Wscript.Arguments.Count
 'Quit VBS script
 'Wscript.Quit
End if

msgbox "Vbs19_実行開始"

Set oExcel=CreateObject("excel.application")
Set fs = CreateObject("Scripting.FileSystemObject")
path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
'パス定義
Set f=fs.OpenTextFile(path+"\bankCd.txt")
DO While f.AtEndOfStream <> True
 BankCode=f.ReadLine 
loop
f.close

Set oWorkBook=oExcel.Workbooks.Open(path+"\01.しんきん預ナビ設定シート_"+BankCode+".xlsx")

'use the worksheet "【別紙】2-②"
sheetNm = "【別紙】2-②"
Set oSheet=oWorkBook.Sheets(sheetNm)

'Get the used range
'Set Sheet = oExcel.Worksheets("Prop_Methods").UsedRange

Set a = fs.CreateTextFile(path+"\19_" + sheetNm + ".sql", True)
a.Close
' Read=1 Write=2 Append =8
Set a = fs.OpenTextFile(path+"\19_" + sheetNm + ".sql", 8, false)


'背景色常数:RGB(255,255,102)値
Const COLORCONST = 6750207

'we can write more value to the text file by using loop

Dim OriginRow:OriginRow = 7 '
Dim OriginCol:OriginCol = 2 '
testAnsert=oSheet.cells(OriginRow,OriginCol)
'Wscript.echo testAnsert

if testAnsert="条件" then 
'Wscript.echo oSheet.cells(OriginRow,OriginCol).Row
'Wscript.echo oSheet.cells(OriginRow,OriginCol).Column
end If

Dim DiffRow:DiffRow = OriginRow - 1 '
Dim DiffCol:DiffCol = OriginCol - 1
'Wscript.echo DiffRow '6
'Wscript.echo DiffCol '1

Dim Col:Col = 17 + DiffCol ' 18

  Col = Col + 3
  ApplyCol = Col + 3

Dim Row:Row = 2 + DiffRow '8
For k = 1 To 72 step 1
  
  Row = Row + 1

  'kは「【別紙】2-②」に対して、表中の「No」列数
  SwitchDivVal = "01"
  If k > 52 then
    SwitchDivVal = "03"
  Else 
    If k > 32 then 
      SwitchDivVal = "02"
    End If
  End If

  'kは「【別紙】2-②」に対して、表中の「No」列数
  Select Case k
    Case 1, 2, 33, 34, 35, 36, 53, 54, 55, 56
        DealingCdVal = "0103"
    Case 3, 4, 37, 38, 39, 40, 57, 58, 59, 60
        DealingCdVal = "0106"
    Case 5, 6, 7, 41, 61
        DealingCdVal = "0202"
    Case 8, 9, 10, 42, 62
        DealingCdVal = "0301"
    Case 11, 12, 13, 14
        DealingCdVal = "0401"
    Case 15, 16, 17, 43, 44, 63, 64
        DealingCdVal = "0104"
    Case 18, 19, 20, 45, 46, 65, 66
        DealingCdVal = "0105"
    Case 21, 22, 23, 47, 67
        DealingCdVal = "0203"
    Case 24, 25, 26, 48, 68
        DealingCdVal = "0302"
    Case 27, 28, 29, 49, 50, 69, 70
        DealingCdVal = "0107','0108"
    Case 30, 31, 32, 51, 52, 71, 72
        DealingCdVal = "0109"
  End Select
  
  'kは「【別紙】2-②」に対して、表中の「No」列数
  Select Case k
    Case 1, 3, 10, 13, 27, 30, 41, 61
        TargetDealingCdVal = "0203"
    Case 2, 4, 7, 14, 28, 31, 42, 62
        TargetDealingCdVal = "0302"
    Case 5, 8, 11, 33, 37, 53, 57
        TargetDealingCdVal = "0104"
    Case 6, 9, 12, 34, 38, 54, 58
        TargetDealingCdVal = "0105"
    Case 17, 20, 23, 26, 29, 32
        TargetDealingCdVal = "0401"
    Case 15, 18, 25, 47, 67
        TargetDealingCdVal = "0202"
    Case 16, 19, 22, 48, 68
        TargetDealingCdVal = "0301"
    Case 21, 24, 43, 45, 49, 51, 63, 65, 69, 71
        TargetDealingCdVal = "0103"
    Case 44, 46, 50, 52, 64, 66, 70, 72
        TargetDealingCdVal = "0106"
    Case 35, 39, 55, 59
        TargetDealingCdVal = "0107','0108"
    Case 36, 40, 56, 60
        TargetDealingCdVal = "0109"
  End Select


  value = oSheet.cells(Row,Col)
  
  Select Case value
    Case "○"
        Val = 1
    Case ""
        Val = 0
  End Select
  
  
  cellColor=oSheet.cells(Row,Col).DisplayFormat.Interior.Color

  applyVal = oSheet.cells(Row,ApplyCol)
  Select Case applyVal
    Case "○"
        ApplicationFlgVal = 1
    Case ""
        ApplicationFlgVal = 0
  End Select
  
  If cellColor=COLORCONST and (Val=1) then
   a.WriteLine "UPDATE M_SWITCH_SHORT_SALES SET ApplicationFlg = " + "'" + CStr(ApplicationFlgVal) + "'" + ",LastUpdBankerNm = 'MAINTENANCE',LastUpdDateTime = CURRENT_TIMESTAMP WHERE SwitchDiv = " + "'" + CStr(SwitchDivVal) + "'" + " AND DealingCd IN ("+ "'" + CStr(DealingCdVal) + "'" + ") AND TargetDealingCd IN ("+ "'" + CStr(TargetDealingCdVal) + "')" + ";"
  else
  End If


Next

a.Close


Set oSheet=Nothing 
oExcel.Quit

msgbox "Vbs19_実行終了"
===========================================================================================
if(Wscript.Arguments.Count<3) then
 'msgbox "The count of Arguments is "&Wscript.Arguments.Count
 'Quit VBS script
 'Wscript.Quit
End if

msgbox "Vbs20_実行開始"

Set oExcel=CreateObject("excel.application")
Set fs = CreateObject("Scripting.FileSystemObject")
path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
'パス定義

Set f=fs.OpenTextFile(path+"\bankCd.txt")
DO While f.AtEndOfStream <> True
 BankCode=f.ReadLine 
loop
f.close

Set oWorkBook=oExcel.Workbooks.Open(path+"\01.しんきん預ナビ設定シート_"+BankCode+".xlsx")

'use the worksheet "【別紙】2-③"
sheetNm = "【別紙】2-③"
Set oSheet=oWorkBook.Sheets(sheetNm)

'Get the used range
'Set Sheet = oExcel.Worksheets("Prop_Methods").UsedRange

Set a = fs.CreateTextFile(path+"\20_" + sheetNm + ".sql", True)
a.Close
' Read=1 Write=2 Append =8
Set a = fs.OpenTextFile(path+"\20_" + sheetNm + ".sql", 8, false)


'背景色常数:RGB(255,255,102)値
Const COLORCONST = 6750207

'we can write more value to the text file by using loop

Dim OriginRow:OriginRow = 11 '
Dim OriginCol:OriginCol = 3 '
testAnsert=oSheet.cells(OriginRow,OriginCol)
'Wscript.echo testAnsert


Dim DiffRow:DiffRow = OriginRow - 1 '
Dim DiffCol:DiffCol = OriginCol - 1 
'Wscript.echo DiffRow '10
'Wscript.echo DiffCol '2

'Dim FinanAsesetFromVal, FinanAsesetToVal, InvRatioThresholdVal

Dim Stp:Stp = 0 '
Do Until Stp = 11

  Dim Col:Col = 18 + DiffCol ' 20
  Dim Row:Row = 4 + DiffRow ' 14

  Stp = Stp + 1
  Row = Stp + Row


For k = 1 To 3 step 1
  
  Col = Col + 9
  If k = 2 then
    Col = Col + 2
  End If


  'Wscript.echo Row
  'Wscript.echo oSheet.cells(Row,Col)
  InvRatioCheckDivVal = 1

  FinancialAssetCdVal = Stp
  
  Select Case Col
    Case 29
        FinanAsesetFromVal =  oSheet.cells(Row,Col)
        If (FinanAsesetFromVal = "" OR FinanAsesetFromVal = "0") then
          FinancialAssetCdVal = ""
          EqualFlg = ""
        else EqualFlgVal = 1
        End If
        cellColor1 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
        'Wscript.echo cellColor1
    Case 40
        FinanAsesetToVal = oSheet.cells(Row,Col)
        cellColor2 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
        'Wscript.echo cellColor2
    Case 49
        InvRatioThresholdVal = oSheet.cells(Row,Col)
        cellColor3 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
        'Wscript.echo cellColor3
  End Select

  'cellColor=oSheet.cells(Row,Col).DisplayFormat.Interior.Color
  
  'cellColor1 = FinanAsesetFromVal.DisplayFormat.Interior.Color
  'cellColor2 = FinanAsesetToVal.DisplayFormat.Interior.Color
  'cellColor3 = InvRatioThresholdVal.DisplayFormat.Interior.Color

  
Next
  If ( cellColor1=COLORCONST or cellColor2=COLORCONST or cellColor3=COLORCONST ) then
     a.WriteLine "UPDATE M_FINANASSETFIT SET FinanAsesetFrom = " + "'" + CStr(FinanAsesetFromVal) + "'" + ", FinanAsesetTo = " + "'" + CStr(FinanAsesetToVal) + "'" + ", InvRatioThreshold = " + "'" + CStr(InvRatioThresholdVal) + "'" + ", EqualFlg = " + "'" + CStr(EqualFlgVal) + "'" + ", LastUpdBankerNm = 'MAINTENANCE', LastUpdDateTime = CURRENT_TIMESTAMP WHERE InvRatioCheckDiv = '1' AND FinancialAssetCd = "+ "'" + CStr(FinancialAssetCdVal) + "'" + ";"
  else
  End If

Loop

a.Close

Set oSheet=Nothing 
oExcel.Quit

msgbox "Vbs20_実行終了"
=========================================================================================================
if(Wscript.Arguments.Count<3) then
 'msgbox "The count of Arguments is "&Wscript.Arguments.Count
 'Quit VBS script
 'Wscript.Quit
End if

msgbox "Vbs23_実行開始"

Set oExcel=CreateObject("excel.application")
Set fs = CreateObject("Scripting.FileSystemObject")
path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
'パス定義

Set f=fs.OpenTextFile(path+"\bankCd.txt")
DO While f.AtEndOfStream <> True
 BankCode=f.ReadLine 
loop
f.close

Set oWorkBook=oExcel.Workbooks.Open(path+"\01.しんきん預ナビ設定シート_"+BankCode+".xlsx")


'use the worksheet "【別紙】2-④"
sheetNm = "【別紙】2-④"
Set oSheet=oWorkBook.Sheets(sheetNm)


'Get the used range
'Set Sheet = oExcel.Worksheets("Prop_Methods").UsedRange


Set a = fs.CreateTextFile(path+"\23_" + sheetNm + ".sql", True)
a.Close
' Read=1 Write=2 Append =8
Set a = fs.OpenTextFile(path+"\23_" + sheetNm + ".sql", 8, false)

'背景色常数:RGB(255,255,102)値
Const COLORCONST = 6750207

'we can write more value to the text file by using loop

Dim OriginRow:OriginRow = 7 '
Dim OriginCol:OriginCol = 2 '
testAnsert=oSheet.cells(OriginRow,OriginCol)
'Wscript.echo testAnsert

Dim DiffRow:DiffRow = OriginRow - 1 '
Dim DiffCol:DiffCol = OriginCol - 1
'Wscript.echo DiffRow '6
'Wscript.echo DiffCol '1

Dim Col:Col = 9 + DiffCol '10

Dim Stp:Stp = 0 '

Do Until Stp = 8
  
  Col = Col + 1
  Stp = Stp + 1
  CodeValueVal = Stp 
  
Dim Row:Row = 3 + DiffRow '9
Dim BeginnerCheckFlgVal:BeginnerCheckFlgVal = 0
For k = 1 To 5 step 1 
  Row = Row + 1

  value=oSheet.cells(Row,Col)
  cellColor=oSheet.cells(Row,Col).DisplayFormat.Interior.Color
  
  If ( value = "経験なし" and cellColor=COLORCONST ) then
    BeginnerCheckFlgVal = k - 1
  End If


Next

  If BeginnerCheckFlgVal <> 0 then
   a.WriteLine "UPDATE M_CUSTOMERCARDCODE SET BeginnerCheckFlg = " + "'" + CStr(BeginnerCheckFlgVal) + "'" + ",LastUpdBankerNm = 'MAINTENANCE',LastUpdDateTime = CURRENT_TIMESTAMP WHERE SettingNo ='141' AND CodeValue = " + "'" + CStr(CodeValueVal) + "';"
  else
  End If

Loop

a.Close


Set oSheet=Nothing 
oExcel.Quit

msgbox "Vbs23_実行終了"
=====================================================================================================
if(Wscript.Arguments.Count<3) then
 'msgbox "The count of Arguments is "&Wscript.Arguments.Count
 'Quit VBS script
 'Wscript.Quit
End if

msgbox "Vbs24_実行開始"

Set oExcel=CreateObject("excel.application")
Set fs = CreateObject("Scripting.FileSystemObject")
path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
'パス定義

Set f=fs.OpenTextFile(path+"\bankCd.txt")
DO While f.AtEndOfStream <> True
 BankCode=f.ReadLine 
loop
f.close

Set oWorkBook=oExcel.Workbooks.Open(path+"\01.しんきん預ナビ設定シート_"+BankCode+".xlsx")


'use the worksheet "【別紙】2-⑤"
sheetNm = "【別紙】2-⑤"
Set oSheet=oWorkBook.Sheets(sheetNm)

'Get the used range
'Set Sheet = oExcel.Worksheets("Prop_Methods").UsedRange

Set a = fs.CreateTextFile(path+"\24_" + sheetNm + ".sql", True)
a.Close
' Read=1 Write=2 Append =8
Set a = fs.OpenTextFile(path+"\24_" + sheetNm + ".sql", 8, false)

'背景色常数:RGB(255,255,102)値
Const COLORCONST = 6750207


'we can write more value to the text file by using loop

Dim OriginRow:OriginRow = 10 '
Dim OriginCol:OriginCol = 2 '
testAnsert=oSheet.cells(OriginRow,OriginCol)
'Wscript.echo testAnsert


Dim DiffRow:DiffRow = OriginRow - 1 '
Dim DiffCol:DiffCol = OriginCol - 1 
'Wscript.echo DiffRow '9
'Wscript.echo DiffCol '1

'Dim FinanAsesetFromVal, FinanAsesetToVal, InvRatioThresholdVal

Dim Stp:Stp = 0 '
Do Until Stp = 5

  Dim Col:Col = 11 + DiffCol ' 12
  Dim Row:Row = 3 + DiffRow ' 12

  Stp = Stp + 1
  Row = Stp + Row
  
  ItemTypeDivVal = Stp

For k = 1 To 9 step 1
  
  Col = Col + 1


  Select Case Col
    Case 14
        ExperienceFlg1Val =  oSheet.cells(Row,Col)
        If ExperienceFlg1Val = "" Then
          ExperienceFlg1Val = 1
        else ExperienceFlg1Val = 0
        End If
        cellColor1 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
    Case 15
        ExperienceFlg2Val =  oSheet.cells(Row,Col)
        If ExperienceFlg2Val = "" Then
          ExperienceFlg2Val = 1
        else ExperienceFlg2Val = 0
        End If
        cellColor2 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
    Case 16
        ExperienceFlg3Val =  oSheet.cells(Row,Col)
        If ExperienceFlg3Val = "" Then
          ExperienceFlg3Val = 1
        else ExperienceFlg3Val = 0
        End If
        cellColor3 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
    Case 17
        ExperienceFlg4Val =  oSheet.cells(Row,Col)
        If ExperienceFlg4Val = "" Then
          ExperienceFlg4Val = 1
        else ExperienceFlg4Val = 0
        End If
        cellColor4 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
    Case 18
        ExperienceFlg5Val =  oSheet.cells(Row,Col)
        If ExperienceFlg5Val = "" Then
          ExperienceFlg5Val = 1
        else ExperienceFlg5Val = 0
        End If
        cellColor5 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
    Case 19
        ExperienceFlg6Val =  oSheet.cells(Row,Col)
        If ExperienceFlg6Val = "" Then
          ExperienceFlg6Val = 1
        else ExperienceFlg6Val = 0
        End If
        cellColor6 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
    Case 20
        ExperienceFlg7Val =  oSheet.cells(Row,Col)
        If ExperienceFlg7Val = "" Then
          ExperienceFlg7Val = 1
        else ExperienceFlg7Val = 0
        End If
        cellColor7 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
    Case 21
        ExperienceFlg8Val =  oSheet.cells(Row,Col)
        If ExperienceFlg8Val = "" Then
          ExperienceFlg8Val = 1
        else ExperienceFlg8Val = 0
        End If
        cellColor8 = oSheet.cells(Row,Col).DisplayFormat.Interior.Color
  End Select


Next

  
  If ( cellColor1=COLORCONST or cellColor2=COLORCONST or cellColor3=COLORCONST or cellColor4=COLORCONST or cellColor5=COLORCONST or cellColor6=COLORCONST or cellColor7=COLORCONST or cellColor8=COLORCONST ) then
     a.WriteLine "UPDATE M_BEGINNERCHECK SET ExperienceFlg1 = " + "'" + CStr(ExperienceFlg1Val) + "'" + ", ExperienceFlg2 = " + "'" + CStr(ExperienceFlg2Val) + "'" + ", ExperienceFlg3 = " + "'" + CStr(ExperienceFlg3Val) + "'" + ", ExperienceFlg4 = " + "'" + CStr(ExperienceFlg4Val) + "'" + ", ExperienceFlg5 = " + "'" + CStr(ExperienceFlg5Val) + "'" + ", ExperienceFlg6 = " + "'" + CStr(ExperienceFlg6Val) + "'"  + ", ExperienceFlg7 = " + "'" + CStr(ExperienceFlg7Val) + "'" + ", ExperienceFlg8 = " + "'" + CStr(ExperienceFlg8Val) + "'"+ ", LastUpdBankerNm = 'MAINTENANCE', LastUpdDateTime = CURRENT_TIMESTAMP WHERE ItemTypeDiv = "+ "'" + CStr(ItemTypeDivVal) + "'" + ";"
  else
  End If

Loop

a.Close

Set oSheet=Nothing 
oExcel.Quit

msgbox "Vbs24_実行終了"
===============================================================================
msgbox "◆実行開始◆"

path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
'パス定義


'◆◆◆
Set fs = CreateObject("Scripting.FileSystemObject")
Set bankCdf = fs.CreateTextFile(path+"\bankCd.txt", True)
bankCdf.Close
Set bankCdf = fs.OpenTextFile(path+"\bankCd.txt", 8,false)


'================================
'自分のファイルのフォルダ名を取得
myPath = fs.getParentFolderName(WScript.ScriptFullName)

'フォルダをセット
Set FOL = fs.GetFolder(myPath)
'フォルダ内ループ(Excelファイル名取得)
 For Each Fil In FOL.Files
  If InStr(Fil.Name, ".xlsx") <> 0 Then
    FileNm = Fil.Name
  End If
 Next

FileNm = Replace(FileNm, ".xlsx", "")
BankCode = Right(FileNm, 4)
WScript.Echo BankCode
 
'オブジェクト破棄
Set FOL = Nothing
Set FSO = Nothing
'================================

'BankCode = InputBox("金庫コードを入力してください") '★
bankCdf.WriteLine BankCode
bankCdf.close
'◆◆◆

Set vbsf = fs.CreateTextFile(path+"\vbsfNmList.txt", True)
vbsf.Close
Set vbsf = fs.OpenTextFile(path+"\vbsfNmList.txt", 8,false)


vbsf.WriteLine "01_【別紙】3-④.vbs"
vbsf.WriteLine "02_【別紙】3-⑤.vbs"
vbsf.WriteLine "03_【別紙】3-⑥.vbs"
vbsf.WriteLine "04_3.業務・画面関連.vbs"
vbsf.WriteLine "05_【別紙】3-①.vbs"
vbsf.WriteLine "06_【別紙】3-③.vbs"
vbsf.WriteLine "07_【別紙】3-②.vbs"
vbsf.WriteLine "08_【別紙】2-⑥.vbs"
vbsf.WriteLine "09_【別紙】3-⑦.vbs"
vbsf.WriteLine "10_【別紙】約定連携-④.vbs"
vbsf.WriteLine "11_【別紙】約定連携-⑤.vbs"
vbsf.WriteLine "12_【別紙】1-①.vbs"
vbsf.WriteLine "13_【別紙】1-②.vbs"
vbsf.WriteLine "14_【別紙】1-③.vbs"
vbsf.WriteLine "15_【別紙】1-④.vbs"
vbsf.WriteLine "16_【別紙】1-⑤.vbs"
vbsf.WriteLine "17_2.コンプラ設定.vbs"
vbsf.WriteLine "18_【別紙】2-①.vbs"
vbsf.WriteLine "19_【別紙】2-②.vbs"
vbsf.WriteLine "20_【別紙】2-③.vbs"
vbsf.WriteLine "21_【別紙】約定連携-②.vbs"
vbsf.WriteLine "22_【別紙】約定連携-③.vbs"
vbsf.WriteLine "23_【別紙】2-④.vbs"
vbsf.WriteLine "24_【別紙】2-⑤.vbs"

vbsf.close

'With CreateObject("Wscript.Shell").Run(path+"\test1.vbs")
'.Run(path+"\test2.vbs")
'End With

'起動用のオブジェクトを生成
Dim objWsh
Set objWsh = WScript.CreateObject("WScript.Shell")
'各モジュールvbsを実行

'Set f=fs.OpenTextFile(path+"\vbsfNmList.txt")
'DO While f.AtEndOfStream <> True
 'tf=f.ReadLine 

 'msgbox "GAN: "&tf
'loop

'f.close

Dim Stp:Stp = 0 '
Do Until Stp = 24 '★★

  Stp = Stp + 1
  
  StpStr = CStr(Stp)
  If Stp < 10 Then
     StpStr = "0" & CStr(Stp)
  End If
  
  
  Dim ts
  Set ts = fs.OpenTextFile(path+"\vbsfNmList.txt",1,True) 'いったん読み取りで開く
  DO While ts.AtEndOfStream <> True
     tf=ts.ReadLine 

     If Left(tf, 2) = StpStr Then
       value = tf
     End If
  loop

  ts.close
  
  'WScript.echo value
  
  '同期実行
  'objWsh.Run(path+"\test"+CStr(Stp) +".vbs")
  'ファイル存在チェック
  If fs.FileExists(path+"\" + value) Then
    '非同期実行
    objWsh.Run path+"\" + value,,True
  End If

  '3秒間停止する
  'WScript.Sleep 3000

Loop


msgbox "◆実行終了◆"


Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(path+"\bankCd.txt") 'ファイル削除
fso.DeleteFile(path+"\vbsfNmList.txt") 'ファイル削除
set fso = nothing
====================================================================================
@echo off
@rem 名称        :○○の更新
@rem 実行対象    :預かり資産ナビシステムサーバー
@rem 概要        :○○の更新を行う。


set PASSWORD=Canon01#
set FORMATDIR=Format

set DATEZ=%date: =0%
set TIMEZ=%time: =0%
set LOG=○○○○更新_%DATEZ:~0,4%%DATEZ:~5,2%%DATEZ:~8,2%%TIMEZ:~0,2%%TIMEZ:~3,2%.log

REM サーバー名(サーバーのPC名\インスタンス名)
set dbServer=localhost

echo ○○○○の更新処理を行います。
set /P DBNAME="DB名を指定してください:"
REM set DBNAME=HANBAI
set TSVDIR=TSV

echo ■○○○○更新開始■ >> %LOG% 2>&1

REM ★SQLファイルを実行
for %%a in (*.sql) do (
  sqlcmd -S %dbServer% -d %DBNAME% -E -i %%a
)


echo ■○○○○更新完了■ >> %LOG% 2>&1
echo 処理が完了しました。

pause

===========================================================================================================
xxx.vbs

If(Wscript.Arguments.Count<3) then
 msgbox "The count of Arguments is "&Wscript.Arguments.Count
 'Quit VBS script
 'Wscript.Quit
End If


Set objArg = Wscript.Arguments
If objArg.Count = 0 Then
    Wscript.Echo "OK"
Else
    Wscript.Echo objArg(0)
End If

msgbox "実行開始"
'BankCode = InputBox("金庫コードを入力してください")
path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
'パス定義
Wscript.echo path


Dim BankCode:BankCode = InputBox("金庫コードを入力してください")
'Set oExcel=CreateObject("excel.application")
'Set oWorkBook=oExcel.Workbooks.Open(path+"\01.しんきん預ナビ設定シート_"+BankCode+".xlsx")
Wscript.echo BankCode

Set WshShell = WScript.CreateObject("WScript.Shell")
result = WshShell.Run(path+"\test1.vbs",BankCode)
Wscript.echo "result :"&result

'BankCode = InputBox("金庫コードを入力してください")
'With CreateObject("Wscript.Shell").Run(path+"\test1.vbs",BankCode,True)
  '.Run(path+"\test2.vbs",,True)
'End With 
==================================================================================================
Contains.vbs

Dim fs 
Dim fn 

Set fs = WScript.CreateObject("Scripting.FileSystemObject") 
path = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
msgbox path

'Set tf = fs.CreateTextFile(path+"\test.txt", True)
'Set tf = fs.OpenTextFile(path+"\test.txt") 


Dim Str1 , Str2
    'Str1 = "やむえむのExcel VBAメモ"
    'Str2 = "VBA"
    
    Str1 = "1:可"
    Str2 = ":"
    
    If InStr(Str1, Str2) <> 0 Then
        '文字列が含まれていた場合の処理をいれる
        MsgBox "「" & Str1 & "」 に 「" & Str2 & "」 は含まれます。"
End If 

==================================================================================================

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值