VBS
■プログラム/スクリプト:VBSファイルパス Dim excelApp,macro file = WScript.Arguments(0)macro = WScript.Arguments(1) Set excelApp = CreateObject("Excel.Application") excelApp.Visible = False 'Excelを非表示にするexcelApp.DisplayAlerts = False…
Sub SaveCSVWithDate() Dim savePath As String Dim fileName As String Dim currentDate As String ' 現在の日付を取得し、yyyymmdd形式にフォーマットする currentDate = Format(Date, "yyyymmdd") ' 保存先のパスを指定する場合 savePath = "C:\YourFolde…
Dim FilePathFilePath = "D:\ThinkpadMark3\自学\filename変更_bat類\.xlsm\繰り返しCopy.xlsm" Dim appSet app = CreateObject("Excel.Application")app.Visible = trueapp.Workbooks.Open FilePathapp.Run "Module1.繰り返し" app.DisplayAlerts = False a…
''vbs------------ ' Create Internet Explorer ObjectSet IE = CreateObject("InternetExplorer.Application") ' Set visibility to true to make it visible, false to hide itIE.Visible = True ' Navigate to the specified webpageIE.Navigate "https:/…
Option Explicit ' ドロップアウトするフォルダを指定しますConst sourceFolder = "Z:\Work\" ' 出力フォルダを指定しますConst outputFolder = "Z:\Work\" Dim objFSO, objFolder, objFileDim shell, newName, fileName ' File System Object を作成しますS…
' フォルダのパスを指定folderPath = "Z:\Work" ' 出力ファイルの保存場所とファイル名を指定 ’desktopPath = CreateObject("WScript.Shell").SpecialFolders("Desktop")outputFolderPath = "C:\Custom\Path"outputFileName = "output.txt" ' ファイル一覧を…
On Error Resume Next Set objFSO = CreateObject("Scripting.FileSystemObject") ' スクリプトのフルパスを取得scriptPath = WScript.ScriptFullName ' スクリプトが存在するディレクトリを取得scriptFolder = objFSO.GetParentFolderName(scriptPath) ' フ…
Set objExcel = CreateObject("Excel.Application")objExcel.Visible = False ' Excelウィンドウを非表示にする ' ExcelファイルのパスstrExcelPath = "C:\パス\MyExcelFile.xlsm" ' Excelファイルを開くSet objWorkbook = objExcel.Workbooks.Open(strExcel…
Set objShell = CreateObject("WScript.Shell")objShell.Run "Z:\Work\立ち上げたいバッチ.bat", 1, True
Set objFSO = CreateObject("Scripting.FileSystemObject") ' ソースフォルダのパスを指定sourceFolder = "C:\パス\から\あなたの\ソース\フォルダ"'スクリプトが配置されているフォルダをソースフォルダとして指定'scriptFolder = Replace(WScript.ScriptFu…
Set objFSO = CreateObject("Scripting.FileSystemObject") ' ソースフォルダのパスを指定sourceFolder = "C:\パス\から\あなたの\ソース\フォルダ"'スクリプトが配置されているフォルダをソースフォルダとして指定'scriptFolder = Replace(WScript.ScriptFu…
Option Explicit Const BIF_NEWDIALOGSTYLE = &H40Const BIF_NONEWFOLDERBUTTON = &H200Const BIF_RETURNONLYFSDIRS = &H1 Const FOR_READING = 1Const FOR_WRITING = 2 Const TAG_BEGIN1 = "#@~^" Const TAG_BEGIN2 = "==" Const TAG_BEGIN2_OFFSET = 10 Co…
Option Explicit dim oEncoder, oFilesToEncode, file, sDest dim sFileOut, oFile, oEncFile, oFSO, i dim oStream, sSourceFile set oFilesToEncode = WScript.Arguments set oEncoder = CreateObject("Scripting.Encoder") For i = 0 to oFilesToEncode.C…
Option Explicit Dim objFSO, objFolder, objFile, strSourceFolderPath, strDestinationPath ' 引数が渡されているか確認If WScript.Arguments.Count > 0 Then ' ドラッグ&ドロップされたフォルダのパスを取得 strSourceFolderPath = WScript.Arguments(0)…
' フォルダのパスを指定folderPath = "Z:\Work" ' 出力ファイルのファイル名を指定outputFileName = "output.txt" ' ファイル一覧を取得Set objFSO = CreateObject("Scripting.FileSystemObject")Set objFolder = objFSO.GetFolder(folderPath)Set colFiles …
Option Explicit ' VBS スクリプトのディレクトリパスを取得Dim scriptDirscriptDir = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\")) ' フォルダとname.txtの相対パスを指定Dim folderPath, nameFilePathfolderPath = scriptDir ' …
Const n = 8 ' パスワードの桁数Dim chars, upper, pointer, passwordDim logFilePath, logMessage chars = "abcdefghijkmnpqrstuvwxyz0123456789*-_"upper = Len(chars) Randomize For i = 1 To n pointer = Int(Rnd * upper) + 1 password = password + Mi…
Option ExplicitDim a, c, cn, cv, f, i, n, so, wa, x, ySet so = CreateObject("Scripting.FileSystemObject")Set wa = WScript.Arguments If wa.Count <> 1 or LCase(so.GetExtensionName(wa(0))) <> "csv" ThenMsgBox("ドラッグ&ドロップできるのは、cs…
' FileSearchWithOutput.vbs Dim folderPath, searchValue, outputFilefolderPath = InputBox("フォルダのパスを入力してください:")searchValue = InputBox("検索する部分文字列を入力してください:")outputFile = "output.txt" If folderPath = "" Or sear…
資料ファイルシートをコピーしようすると、見覚えのない名前定義が出てきて思うようにコピーできない時の対策。 対象bookを下記のvbs(名前の管理リセット.vbs)にドロップし不要定義を削除。 '名前の管理リセット.vbs ’下記をテキストにコピーし 名前の管理リ…
自分のBMI値知る為に、忘備録用として。。。 File名:BMI.vbs※vbs text中身は下記の通り。 H = InputBox("身長(㎝)を入力してください。")W = InputBox("体重(Kg)を入力してください。")H = H/100BMI = W/H/HMsgBox Round(BMI,1), vbOKonly + vbInfomatio…