This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JScript Interactive Shell | |
// JScript 簡易対話型シェル | |
// CScript.exe での起動を強制する | |
if (WScript.FullName.slice(-"*Script.exe".length).toLowerCase() == "wscript.exe") { | |
new ActiveXObject("WScript.Shell").Run("cscript \"" + WScript.ScriptFullName + "\""); | |
WScript.Quit(); | |
} | |
WScript.Echo("JScript Interactive Shell\n"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.trim = function () { | |
return this.replace(/^\s+|\s+$/g, ""); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateProgressBar (percentage) { | |
percentage = Math.floor(percentage * 100); | |
var start = 50 - Math.floor(percentage / 2); | |
var end = start + 50; | |
return ("\r" + (" " + percentage).slice(-3) + "% ["+"##################################################..................................................".slice(start, end) + "]"); | |
} | |
// for(var i=0;i<=100;i++){WScript.StdOut.Write(generateProgressBar(i/100));WScript.Sleep(100);}WScript.Echo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' <summary> | |
''' 指定されたワークブックの、配列で与えられたシート名を持つワークシートを印刷する | |
''' 引数チェックを行っていないため要注意 | |
''' プリンター名やシートの存在を確認すること | |
''' </summary> | |
''' <param name="objWorkbook">対象のワークブック<param> | |
''' <param name="strWorksheetNameArray">ワークシート名の配列 (Array("hoge", "fuga", "piyo") ...)<param> | |
''' <param name="lngCopies">部数<param> | |
''' <param name="strPrinterName">プリンター名<param> | |
''' <param name="strPrinterSettingFilePath">プリンターの印刷設定<param> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JScript Interactive Shell | |
// JScript 簡易対話型シェル | |
// CScript.exe での起動を強制する | |
if (WScript.FullName.slice(-"*Script.exe".length).toLowerCase() == "wscript.exe") { | |
var strArgs = ""; | |
for (var i = 0; i < WScript.Arguments.Count(); i++) { | |
strArgs += " \"" + WScript.Arguments.Item(i) + "\""; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If LCase(Right(WScript.FullName, Len("*Script.exe"))) <> "cscript.exe" Then | |
Dim strArgs: strArgs = "" | |
Dim i | |
For i = 0 To WScript.Arguments.Count - 1 | |
strArgs = strArgs + " """ & WScript.Arguments(i) & """" | |
Next | |
Dim objWshShell: Set objWshShell = CreateObject("WScript.Shell") | |
objWshShell.Run("cscript """ + WScript.ScriptFullName + """" + strArgs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' <summary> | |
''' ワークシートを配列に格納する | |
''' インデックスは1始まり、実際のセル位置と対応 | |
''' </summary> | |
''' <param name="objWorksheet">対象のワークシート</param> | |
''' <returns>配列</returns> | |
Public Function Worksheet2Array(ByVal objWorksheet As Worksheet) As String() | |
Dim strArray() As String, objCell As Range | |
Dim Row As Long, Column As Long |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
''' 保存のたびにVBコンポーネントをエクスポートする | |
''' オプション>セキュリティー センター>セキュリティー センターの設定>マクロの設定>VBA プロジェクト オブジェクト モデルへのアクセスを信頼する | |
Private Sub Workbook_AfterSave(ByVal Success As Boolean) | |
If Not Success Then Exit Sub | |
Debug.Print ExportComponents(ThisWorkbook, ThisWorkbook.path & "\src") | |
Debug.Print Exec("cd """ & ThisWorkbook.path & "\src" & """ & git add .") | |
Debug.Print Exec("cd """ & ThisWorkbook.path & "\src" & """ & git commit -m ""auto_" & Replace(Replace(Date & "_" & Time, "/", ""), ":", "") & """") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main(ByVal args) | |
If args.Count = 0 Then | |
WScript.Echo("ExportVBComponents.vbs is the most simple solution to manage your VBA project with a version control system." & vbCrLf & _ | |
vbCrLf & _ | |
"Useage" & vbTab & " : [ engine ] ExportVBComponents.vbs [ xlsmfile ]" & vbCrLf & _ | |
vbTab & "engine" & vbTab & " : Usually you can choose ""cscript"" or ""wscript""." & vbCrLf & _ | |
vbTab & "xlsmfile" & vbTab & " : An excel file with VBA." & vbCrLf & _ | |
"...Or just Drag'n'Drop xlsm file to this script." & vbCrLf & _ | |
vbCrLf & _ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' フォルダ内の非SJIS文字を_に置き換える | |
''' zip圧縮時の不正文字対策 | |
Sub Main() | |
If WScript.Arguments.Count <> 1 Then WScript.Quit | |
Dim fso | |
Set fso = CreateObject("Scripting.FileSystemObject") |
OlderNewer