RAS プレイグラウンド English GitHub

型定義(Excel・VBA)

VBA

RAS に同梱している VBA 標準ライブラリの型定義です。関数・定数・err / debug はトップレベルに、型と列挙型は名前空間 VBA にあります。RAS のソースでは camelCase で書きます(msgBox、inputBox、uBound)。生成される VBA には各項目の「VBA:」の綴りが出力されます。

Open / Print # / Close などのファイルの文は、FileIO の関数として書きます(早見表 の「ファイルの読み書き」)。文字コードを指定した読み書きは fs を使います。

リファレンス

インターフェイス VBA.ErrObject

直前に発生した実行時エラーの情報を保持する。

Microsoft のリファレンス

#
number: int

エラー番号。0 ならエラーなし。

Microsoft のリファレンス

VBA: Number

#
description: string

エラーの説明。

Microsoft のリファレンス

VBA: Description

#
source: string

エラーを発生させたオブジェクトまたはアプリケーションの名前。

Microsoft のリファレンス

VBA: Source

#
helpFile: string

エラーに対応するヘルプ ファイルのパス。

Microsoft のリファレンス

VBA: HelpFile

#
helpContext: int

ヘルプ ファイル内のトピックのコンテキスト ID。

Microsoft のリファレンス

VBA: HelpContext

#
readonly lastDllError: int

直前の DLL 呼び出しで設定されたシステム エラー コード。

Microsoft のリファレンス

VBA: LastDllError

#
raise(number: int, source?: any, description?: any, helpFile?: any, helpContext?: any): void

実行時エラーを発生させる。

Microsoft のリファレンス

VBA: Raise

#
clear(): void

エラー情報をすべて消去する。

Microsoft のリファレンス

VBA: Clear

vba.d.ras

インターフェイス VBA.Collection

順序付きの項目の集まり。インデックスは 1 始まりで、キー文字列でも参照できる。

Microsoft のリファレンス

#
(index: any): any

インデックスまたはキーで項目を返す(既定メンバー)。

Microsoft のリファレンス

#
item(index: any): any

インデックスまたはキーで項目を返す。

Microsoft のリファレンス

VBA: Item

#
count(): int

項目の数。

Microsoft のリファレンス

VBA: Count

#
add(item: any, key?: any, before?: any, after?: any): void

項目を追加する。before / after で挿入位置を指定できる。

Microsoft のリファレンス

VBA: Add

#
remove(index: any): void

インデックスまたはキーで項目を削除する。

Microsoft のリファレンス

VBA: Remove

vba.d.ras

インターフェイス VBA.DebugObject

イミディエイト ウィンドウへの出力とアサーションを行う。

Microsoft のリファレンス

#
print(arg1?: cellValue, arg2?: cellValue, arg3?: cellValue, arg4?: cellValue, arg5?: cellValue, arg6?: cellValue, arg7?: cellValue, arg8?: cellValue): void

イミディエイト ウィンドウに値を出力する。

Microsoft のリファレンス

VBA: Print

#
assert(cond: boolean): void

条件が偽のとき、開発中の実行を中断する。

Microsoft のリファレンス

VBA: Assert

vba.d.ras

列挙型 VBA.VbMsgBoxStyle

MsgBox に表示するボタン・アイコン・既定ボタンなどを指定する(加算して組み合わせる)。

Microsoft のリファレンス

#
vbOKOnly = 0
#
vbOKCancel = 1
#
vbAbortRetryIgnore = 2
#
vbYesNoCancel = 3
#
vbYesNo = 4
#
vbRetryCancel = 5
#
vbCritical = 16
#
vbQuestion = 32
#
vbExclamation = 48
#
vbInformation = 64
#
vbDefaultButton1 = 0
#
vbDefaultButton2 = 256
#
vbDefaultButton3 = 512
#
vbDefaultButton4 = 768
#
vbApplicationModal = 0
#
vbSystemModal = 4096
#
vbMsgBoxHelpButton = 16384
#
vbMsgBoxSetForeground = 65536
#
vbMsgBoxRight = 524288
#
vbMsgBoxRtlReading = 1048576

vba.d.ras

列挙型 VBA.KeyCodeConstants

キーボードのキーを表すコード(KeyDown / KeyUp イベントの KeyCode)。

Microsoft のリファレンス

#
vbKeyLButton = 1
#
vbKeyRButton = 2
#
vbKeyCancel = 3
#
vbKeyMButton = 4
#
vbKeyBack = 8
#
vbKeyTab = 9
#
vbKeyClear = 12
#
vbKeyReturn = 13
#
vbKeyShift = 16
#
vbKeyControl = 17
#
vbKeyMenu = 18
#
vbKeyPause = 19
#
vbKeyCapital = 20
#
vbKeyEscape = 27
#
vbKeySpace = 32
#
vbKeyPageUp = 33
#
vbKeyPageDown = 34
#
vbKeyEnd = 35
#
vbKeyHome = 36
#
vbKeyLeft = 37
#
vbKeyUp = 38
#
vbKeyRight = 39
#
vbKeyDown = 40
#
vbKeySelect = 41
#
vbKeyPrint = 42
#
vbKeyExecute = 43
#
vbKeySnapshot = 44
#
vbKeyInsert = 45
#
vbKeyDelete = 46
#
vbKeyHelp = 47
#
vbKeyNumlock = 144
#
vbKey0 = 48
#
vbKey1 = 49
#
vbKey2 = 50
#
vbKey3 = 51
#
vbKey4 = 52
#
vbKey5 = 53
#
vbKey6 = 54
#
vbKey7 = 55
#
vbKey8 = 56
#
vbKey9 = 57
#
vbKeyA = 65
#
vbKeyB = 66
#
vbKeyC = 67
#
vbKeyD = 68
#
vbKeyE = 69
#
vbKeyF = 70
#
vbKeyG = 71
#
vbKeyH = 72
#
vbKeyI = 73
#
vbKeyJ = 74
#
vbKeyK = 75
#
vbKeyL = 76
#
vbKeyM = 77
#
vbKeyN = 78
#
vbKeyO = 79
#
vbKeyP = 80
#
vbKeyQ = 81
#
vbKeyR = 82
#
vbKeyS = 83
#
vbKeyT = 84
#
vbKeyU = 85
#
vbKeyV = 86
#
vbKeyW = 87
#
vbKeyX = 88
#
vbKeyY = 89
#
vbKeyZ = 90
#
vbKeyNumpad0 = 96
#
vbKeyNumpad1 = 97
#
vbKeyNumpad2 = 98
#
vbKeyNumpad3 = 99
#
vbKeyNumpad4 = 100
#
vbKeyNumpad5 = 101
#
vbKeyNumpad6 = 102
#
vbKeyNumpad7 = 103
#
vbKeyNumpad8 = 104
#
vbKeyNumpad9 = 105
#
vbKeyMultiply = 106
#
vbKeyAdd = 107
#
vbKeySeparator = 108
#
vbKeySubtract = 109
#
vbKeyDecimal = 110
#
vbKeyDivide = 111
#
vbKeyF1 = 112
#
vbKeyF2 = 113
#
vbKeyF3 = 114
#
vbKeyF4 = 115
#
vbKeyF5 = 116
#
vbKeyF6 = 117
#
vbKeyF7 = 118
#
vbKeyF8 = 119
#
vbKeyF9 = 120
#
vbKeyF10 = 121
#
vbKeyF11 = 122
#
vbKeyF12 = 123
#
vbKeyF13 = 124
#
vbKeyF14 = 125
#
vbKeyF15 = 126
#
vbKeyF16 = 127

vba.d.ras

列挙型 VBA.VbMsgBoxResult

MsgBox で押されたボタンを表す。

Microsoft のリファレンス

#
vbOK = 1
#
vbCancel = 2
#
vbAbort = 3
#
vbRetry = 4
#
vbIgnore = 5
#
vbYes = 6
#
vbNo = 7

vba.d.ras

列挙型 VBA.VbCompareMethod

文字列比較の方法を指定する。

Microsoft のリファレンス

#
vbBinaryCompare = 0
#
vbTextCompare = 1
#
vbDatabaseCompare = 2

vba.d.ras

列挙型 VBA.VbVarType

VarType が返すデータ型の種類を表す。

Microsoft のリファレンス

#
vbEmpty = 0
#
vbNull = 1
#
vbInteger = 2
#
vbLong = 3
#
vbSingle = 4
#
vbDouble = 5
#
vbCurrency = 6
#
vbDate = 7
#
vbString = 8
#
vbObject = 9
#
vbError = 10
#
vbBoolean = 11
#
vbVariant = 12
#
vbDataObject = 13
#
vbDecimal = 14
#
vbByte = 17
#
vbLongLong = 20
#
vbUserDefinedType = 36
#
vbArray = 8192

vba.d.ras

列挙型 VBA.VbDayOfWeek

曜日、または週の最初の曜日を指定する。

Microsoft のリファレンス

#
vbUseSystemDayOfWeek = 0
#
vbSunday = 1
#
vbMonday = 2
#
vbTuesday = 3
#
vbWednesday = 4
#
vbThursday = 5
#
vbFriday = 6
#
vbSaturday = 7

vba.d.ras

列挙型 VBA.VbFirstWeekOfYear

年の第 1 週の決め方を指定する。

Microsoft のリファレンス

#
vbUseSystem = 0
#
vbFirstJan1 = 1
#
vbFirstFourDays = 2
#
vbFirstFullWeek = 3

vba.d.ras

列挙型 VBA.VbStrConv

StrConv で行う文字種の変換を指定する(加算して組み合わせられる)。

Microsoft のリファレンス

#
vbUpperCase = 1
#
vbLowerCase = 2
#
vbProperCase = 3
#
vbWide = 4
#
vbNarrow = 8
#
vbKatakana = 16
#
vbHiragana = 32
#
vbUnicode = 64
#
vbFromUnicode = 128

vba.d.ras

列挙型 VBA.VbFileAttribute

ファイルやフォルダーの属性を表す(加算して組み合わせる)。

Microsoft のリファレンス

#
vbNormal = 0
#
vbReadOnly = 1
#
vbHidden = 2
#
vbSystem = 4
#
vbVolume = 8
#
vbDirectory = 16
#
vbArchive = 32
#
vbAlias = 64

vba.d.ras

列挙型 VBA.VbAppWinStyle

Shell で起動するプログラムのウィンドウの表示方法を指定する。

Microsoft のリファレンス

#
vbHide = 0
#
vbNormalFocus = 1
#
vbMinimizedFocus = 2
#
vbMaximizedFocus = 3
#
vbNormalNoFocus = 4
#
vbMinimizedNoFocus = 6

vba.d.ras

列挙型 VBA.VbCallType

CallByName で呼び出すプロシージャの種類を指定する。

Microsoft のリファレンス

#
VbMethod = 1
#
VbGet = 2
#
VbLet = 4
#
VbSet = 8

vba.d.ras

列挙型 VBA.VbDateTimeFormat

FormatDateTime の書式を指定する。

Microsoft のリファレンス

#
vbGeneralDate = 0
#
vbLongDate = 1
#
vbShortDate = 2
#
vbLongTime = 3
#
vbShortTime = 4

vba.d.ras

列挙型 VBA.VbTriState

真 / 偽 / 既定値の 3 状態を表す。

Microsoft のリファレンス

#
vbUseDefault = -2
#
vbTrue = -1
#
vbFalse = 0

vba.d.ras

列挙型 VBA.ColorConstants

基本色の RGB 値。

Microsoft のリファレンス

#
vbBlack = 0
#
vbRed = 255
#
vbGreen = 65280
#
vbYellow = 65535
#
vbBlue = 16711680
#
vbMagenta = 16711935
#
vbCyan = 16776960
#
vbWhite = 16777215

vba.d.ras

列挙型 VBA.VbCalendar

使用する暦を指定する。

Microsoft のリファレンス

#
vbCalGreg = 0
#
vbCalHijri = 1

vba.d.ras

列挙型 FileIO.OpenMode

fileOpen でファイルを開くモード(VBA の Open … For <モード>)。値は fileAttr(n, 1) の戻り値と同じ。

Microsoft のリファレンス

#
forInput = 1

読み取り(For Input)。ファイルが無ければエラー 53。

#
forOutput = 2

書き込み(For Output)。ファイルは作り直される。

#
forRandom = 4

固定長のレコード単位の読み書き(For Random)。

#
forAppend = 8

末尾への追記(For Append)。

#
forBinary = 32

バイト単位の読み書き(For Binary)。

vba.d.ras

列挙型 FileIO.OpenAccess

fileOpen で許可する操作(VBA の Open … Access <操作>)。

Microsoft のリファレンス

#
accessDefault = -1

指定しない(モードの既定)。

#
accessRead = 1

読み取りのみ(Access Read)。

#
accessWrite = 2

書き込みのみ(Access Write)。

#
accessReadWrite = 3

読み書き(Access Read Write)。

vba.d.ras

列挙型 FileIO.OpenShare

fileOpen で開いているファイルに、ほかのプロセスから許可する操作(VBA の Open … <ロック>)。

Microsoft のリファレンス

#
lockDefault = -1

指定しない(Lock 句なし)。

#
lockReadWrite = 0

読み書きとも禁止(Lock Read Write)。

#
lockWrite = 1

書き込みを禁止(Lock Write)。

#
lockRead = 2

読み取りを禁止(Lock Read)。

#
lockShared = 3

禁止しない(Shared)。

vba.d.ras

グローバル err

const err: VBA.ErrObject

VBA: Err

直前に発生した実行時エラーの情報。

Microsoft のリファレンス

vba.d.ras

グローバル debug

const debug: VBA.DebugObject

VBA: Debug

イミディエイト ウィンドウへの出力(Debug.Print)とアサーション。

Microsoft のリファレンス

vba.d.ras

グローバル vbCrLf

const vbCrLf: string

復帰と改行(CR + LF)。

Microsoft のリファレンス

vba.d.ras

グローバル vbCr

const vbCr: string

復帰文字(CR)。

Microsoft のリファレンス

vba.d.ras

グローバル vbLf

const vbLf: string

改行文字(LF)。

Microsoft のリファレンス

vba.d.ras

グローバル vbTab

const vbTab: string

vba.d.ras

グローバル vbNullString

const vbNullString: string

値が 0 の文字列ポインター。空文字列 "" とは異なり、DLL 関数に NULL を渡すときに使う。

Microsoft のリファレンス

vba.d.ras

グローバル vbNullChar

const vbNullChar: string

文字コード 0 の文字。

Microsoft のリファレンス

vba.d.ras

グローバル vbNewLine

const vbNewLine: string

実行環境に応じた改行文字(Windows では CR + LF)。

Microsoft のリファレンス

vba.d.ras

グローバル vbBack

const vbBack: string

バックスペース文字。

Microsoft のリファレンス

vba.d.ras

グローバル vbFormFeed

const vbFormFeed: string

フォーム フィード文字。

Microsoft のリファレンス

vba.d.ras

グローバル vbVerticalTab

const vbVerticalTab: string

垂直タブ文字。

Microsoft のリファレンス

vba.d.ras

グローバル vbObjectError

const vbObjectError: int

ユーザー定義エラー番号の基準値(-2147221504)。独自のエラー番号はこれに加算して作る。

Microsoft のリファレンス

vba.d.ras

グローバル dbNull

const dbNull: any

VBA: Null

VBA の Null(有効なデータがないことを表す値)。データベースのフィールドやコントロールの値に Null を入れるとき・Null を返すときに使う。isNull(v) で確かめる。

RAS の null は、any に入れると Empty、オブジェクトでは Nothing になる(Null ではない)。 v == null と v ?? x は、Empty・Nothing・Null のどれも「値なし」として扱う。

Microsoft のリファレンス

vba.d.ras

関数 msgBox

function msgBox(prompt: any, buttons?: VBA.VbMsgBoxStyle, title?: any, helpFile?: any, context?: any): VBA.VbMsgBoxResult

VBA: MsgBox

メッセージ ボックスを表示し、押されたボタンを返す。

Microsoft のリファレンス

vba.d.ras

関数 inputBox

function inputBox(prompt: any, title?: any, defaultValue?: any, xPos?: any, yPos?: any, helpFile?: any, context?: any): string

VBA: InputBox

入力ダイアログを表示し、入力された文字列を返す。キャンセル時は空文字列。

Microsoft のリファレンス

vba.d.ras

関数 createObject

function createObject(className: string, serverName?: string): object

VBA: CreateObject

ProgID を指定して COM オブジェクトを生成する。

Microsoft のリファレンス

vba.d.ras

関数 getObject

function getObject(pathName?: any, className?: any): object

VBA: GetObject

ファイルから、または実行中のインスタンスから COM オブジェクトを取得する。

Microsoft のリファレンス

vba.d.ras

関数 shell

function shell(pathName: any, windowStyle?: VBA.VbAppWinStyle): double

VBA: Shell

プログラムを起動し、そのタスク ID を返す。終了は待たない。

Microsoft のリファレンス

vba.d.ras

関数 environ

function environ(expression: any): string

VBA: Environ

環境変数の値を返す。

Microsoft のリファレンス

vba.d.ras

関数 command

function command(): string

VBA: Command

アプリケーション起動時のコマンド ラインの引数部分を返す。

Microsoft のリファレンス

vba.d.ras

関数 doEvents

function doEvents(): int

VBA: DoEvents

OS に制御を渡して、溜まっているイベントを処理させる。

Microsoft のリファレンス

vba.d.ras

関数 timer

function timer(): float

VBA: Timer

午前 0 時からの経過秒数を返す。

Microsoft のリファレンス

vba.d.ras

関数 beep

function beep(): void

VBA: Beep

ビープ音を鳴らす。

Microsoft のリファレンス

vba.d.ras

関数 appActivate

function appActivate(title: any, wait?: any): void

VBA: AppActivate

指定したタイトルのアプリケーション ウィンドウをアクティブにする。

Microsoft のリファレンス

vba.d.ras

関数 sendKeys

function sendKeys(str: string, wait?: any): void

VBA: SendKeys

アクティブなウィンドウへキー操作を送る。

Microsoft のリファレンス

vba.d.ras

関数 saveSetting

function saveSetting(appName: string, section: string, key: string, setting: string): void

VBA: SaveSetting

レジストリのアプリケーション用領域に設定値を保存する。

Microsoft のリファレンス

vba.d.ras

関数 getSetting

function getSetting(appName: string, section: string, key: string, defaultValue?: any): string

VBA: GetSetting

レジストリのアプリケーション用領域から設定値を読み出す。

Microsoft のリファレンス

vba.d.ras

関数 deleteSetting

function deleteSetting(appName: string, section?: any, key?: any): void

VBA: DeleteSetting

レジストリのアプリケーション用領域からセクションまたはキーを削除する。

Microsoft のリファレンス

vba.d.ras

関数 callByName

function callByName(obj: object, procName: string, callType: VBA.VbCallType, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any

VBA: CallByName

オブジェクトのプロパティやメソッドを、名前の文字列で指定して呼び出す。

Microsoft のリファレンス

vba.d.ras

関数 iIf

function iIf(expression: any, truePart: any, falsePart: any): any

VBA: IIf

条件が真なら 2 番目、偽なら 3 番目の引数を返す。両方の引数が常に評価される。

Microsoft のリファレンス

vba.d.ras

関数 choose

function choose(index: float, choice1?: any, choice2?: any, choice3?: any, choice4?: any, choice5?: any, choice6?: any, choice7?: any, choice8?: any, choice9?: any, choice10?: any): any

VBA: Choose

インデックス(1 始まり)に対応する引数を返す。

Microsoft のリファレンス

vba.d.ras

関数 switch

function switch(arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any, arg9?: any, arg10?: any): any

VBA: Switch

「条件, 値」の組を順に調べ、最初に真になった条件に対応する値を返す。

Microsoft のリファレンス

vba.d.ras

関数 isNumeric

function isNumeric(expression: cellValue): boolean

VBA: IsNumeric

数値として評価できるかどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 isDate

function isDate(expression: cellValue): boolean

VBA: IsDate

日付として評価できるかどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 isEmpty

function isEmpty(expression: cellValue): boolean

VBA: IsEmpty

Variant が未初期化(Empty)かどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 isNull

function isNull(expression: cellValue): boolean

VBA: IsNull

値が Null かどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 isObject

function isObject(expression: cellValue): boolean

VBA: IsObject

オブジェクトを参照しているかどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 isArray

function isArray(varName: cellValue): boolean

VBA: IsArray

配列かどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 isError

function isError(expression: cellValue): boolean

VBA: IsError

エラー値かどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 isMissing

function isMissing(argName: cellValue): boolean

VBA: IsMissing

省略可能な Variant 引数が省略されたかどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 typeName

function typeName(varName: cellValue): string

VBA: TypeName

変数の型名を文字列で返す。

Microsoft のリファレンス

vba.d.ras

関数 varType

function varType(varName: cellValue): VBA.VbVarType

VBA: VarType

変数のデータ型を表す値を返す。

Microsoft のリファレンス

vba.d.ras

関数 array

function array(...args: any[]): any

VBA: Array

引数を要素とする Variant 配列を作る。

Microsoft のリファレンス

vba.d.ras

関数 lBound

function lBound(arr: any, dimension?: int): int

VBA: LBound

配列の指定した次元の最小の添字を返す。

Microsoft のリファレンス

vba.d.ras

関数 uBound

function uBound(arr: any, dimension?: int): int

VBA: UBound

配列の指定した次元の最大の添字を返す。空の配列では実行時エラーになる。

Microsoft のリファレンス

vba.d.ras

関数 len

function len(s: any): int

VBA: Len

文字列の文字数、または変数の格納に必要なバイト数を返す。

Microsoft のリファレンス

vba.d.ras

関数 lenB

function lenB(s: any): int

VBA: LenB

文字列のバイト数を返す。

Microsoft のリファレンス

vba.d.ras

関数 left

function left(s: string, length: int): string

VBA: Left

文字列の左端から指定した文字数を返す。

Microsoft のリファレンス

vba.d.ras

関数 mid

function mid(s: string, start: int, length?: int): string

VBA: Mid

文字列の指定位置(1 始まり)から指定した文字数を返す。

Microsoft のリファレンス

vba.d.ras

関数 inStr

function inStr(start: any, string1?: any, string2?: any, compare?: VBA.VbCompareMethod): int

VBA: InStr

文字列 string1 の中で string2 が最初に現れる位置(1 始まり、なければ 0)を返す。 VBA では先頭の start を省略できるが、この宣言は (start, string1, string2, compare) の順の 1 形式のみ。コンパイラは 4 つの引数をすべて出力する。

Microsoft のリファレンス

vba.d.ras

関数 inStrRev

function inStrRev(stringCheck: string, stringMatch: string, start?: int, compare?: VBA.VbCompareMethod): int

VBA: InStrRev

文字列の末尾側から検索し、見つかった位置(1 始まり、なければ 0)を返す。

Microsoft のリファレンス

vba.d.ras

関数 replace

function replace(expression: string, find: string, replace: string, start?: int, count?: int, compare?: VBA.VbCompareMethod): string

VBA: Replace

文字列中の部分文字列を別の文字列に置き換える。

Microsoft のリファレンス

vba.d.ras

関数 trim

function trim(s: string): string

VBA: Trim

前後の空白を取り除く。

Microsoft のリファレンス

vba.d.ras

関数 lTrim

function lTrim(s: string): string

VBA: LTrim

先頭の空白を取り除く。

Microsoft のリファレンス

vba.d.ras

関数 rTrim

function rTrim(s: string): string

VBA: RTrim

末尾の空白を取り除く。

Microsoft のリファレンス

vba.d.ras

関数 uCase

function uCase(s: string): string

VBA: UCase

大文字に変換する。

Microsoft のリファレンス

vba.d.ras

関数 lCase

function lCase(s: string): string

VBA: LCase

小文字に変換する。

Microsoft のリファレンス

vba.d.ras

関数 strComp

function strComp(string1: any, string2: any, compare?: VBA.VbCompareMethod): int

VBA: StrComp

2 つの文字列を比較し、-1 / 0 / 1 を返す。

Microsoft のリファレンス

vba.d.ras

関数 strConv

function strConv(str: any, conversion: VBA.VbStrConv, localeId?: int): any

VBA: StrConv

文字種(大文字 / 小文字、全角 / 半角、ひらがな / カタカナ、Unicode)を変換する。

Microsoft のリファレンス

vba.d.ras

関数 strReverse

function strReverse(expression: string): string

VBA: StrReverse

文字の並びを逆順にした文字列を返す。

Microsoft のリファレンス

vba.d.ras

関数 space

function space(number: int): string

VBA: Space

指定した数の空白からなる文字列を返す。

Microsoft のリファレンス

vba.d.ras

関数 string

function string(number: int, character: any): string

VBA: String

指定した文字を指定回数だけ繰り返した文字列を返す。

Microsoft のリファレンス

vba.d.ras

関数 split

function split(expression: string, delimiter?: any, limit?: int, compare?: VBA.VbCompareMethod): string[]

VBA: Split

区切り文字で分割した文字列の配列(0 始まり)を返す。

Microsoft のリファレンス

vba.d.ras

関数 join

function join(sourceArray: any, delimiter?: any): string

VBA: Join

配列の要素を区切り文字でつないだ文字列を返す。

Microsoft のリファレンス

vba.d.ras

関数 filter

function filter(sourceArray: any, match: string, include?: boolean, compare?: VBA.VbCompareMethod): string[]

VBA: Filter

文字列配列から、指定した文字列を含む(または含まない)要素だけを取り出す。

Microsoft のリファレンス

vba.d.ras

関数 asc

function asc(s: string): int

VBA: Asc

先頭文字の文字コード(ANSI / シフト JIS)を返す。

Microsoft のリファレンス

vba.d.ras

関数 ascW

function ascW(s: string): int

VBA: AscW

先頭文字の Unicode コードを返す。

Microsoft のリファレンス

vba.d.ras

関数 chr

function chr(charCode: int): string

VBA: Chr

文字コード(ANSI / シフト JIS)に対応する文字を返す。

Microsoft のリファレンス

vba.d.ras

関数 chrW

function chrW(charCode: int): string

VBA: ChrW

Unicode コードに対応する文字を返す。

Microsoft のリファレンス

vba.d.ras

関数 hex

function hex(number: any): string

VBA: Hex

数値を 16 進表記の文字列にする。

Microsoft のリファレンス

vba.d.ras

関数 oct

function oct(number: any): string

VBA: Oct

数値を 8 進表記の文字列にする。

Microsoft のリファレンス

vba.d.ras

関数 str

function str(number: any): string

VBA: Str

数値を文字列にする。正の数の先頭には符号用の空白が付く。

Microsoft のリファレンス

vba.d.ras

関数 val

function val(s: string): double

VBA: Val

文字列の先頭にある数字部分を数値にする。

Microsoft のリファレンス

vba.d.ras

関数 format

function format(expression: any, format?: any, firstDayOfWeek?: VBA.VbDayOfWeek, firstWeekOfYear?: VBA.VbFirstWeekOfYear): string

VBA: Format

値を書式指定に従って文字列にする。

Microsoft のリファレンス

vba.d.ras

関数 formatNumber

function formatNumber(expression: any, numDigitsAfterDecimal?: int, includeLeadingDigit?: VBA.VbTriState, useParensForNegativeNumbers?: VBA.VbTriState, groupDigits?: VBA.VbTriState): string

VBA: FormatNumber

数値を、桁区切りや小数点以下の桁数を指定して文字列にする。

Microsoft のリファレンス

vba.d.ras

関数 formatCurrency

function formatCurrency(expression: any, numDigitsAfterDecimal?: int, includeLeadingDigit?: VBA.VbTriState, useParensForNegativeNumbers?: VBA.VbTriState, groupDigits?: VBA.VbTriState): string

VBA: FormatCurrency

数値を通貨形式の文字列にする。

Microsoft のリファレンス

vba.d.ras

関数 formatPercent

function formatPercent(expression: any, numDigitsAfterDecimal?: int, includeLeadingDigit?: VBA.VbTriState, useParensForNegativeNumbers?: VBA.VbTriState, groupDigits?: VBA.VbTriState): string

VBA: FormatPercent

数値をパーセント形式の文字列にする。

Microsoft のリファレンス

vba.d.ras

関数 formatDateTime

function formatDateTime(expression: any, namedFormat?: VBA.VbDateTimeFormat): string

VBA: FormatDateTime

日付や時刻を、定義済みの書式で文字列にする。

Microsoft のリファレンス

vba.d.ras

関数 cStr

function cStr(expression: any): string

VBA: CStr

String に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cLng

function cLng(expression: any): int

VBA: CLng

Long(RAS の int)に変換する。小数部は偶数丸めされる。

Microsoft のリファレンス

vba.d.ras

関数 cInt

function cInt(expression: any): short

VBA: CInt

Integer(RAS の short)に変換する。小数部は偶数丸めされる。

Microsoft のリファレンス

vba.d.ras

関数 cDbl

function cDbl(expression: any): double

VBA: CDbl

Double に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cSng

function cSng(expression: any): float

VBA: CSng

Single(RAS の float)に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cBool

function cBool(expression: any): boolean

VBA: CBool

Boolean に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cDate

function cDate(expression: any): date

VBA: CDate

Date に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cCur

function cCur(expression: any): currency

VBA: CCur

Currency に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cDec

function cDec(expression: any): decimal

VBA: CDec

Decimal に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cByte

function cByte(expression: any): byte

VBA: CByte

Byte に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cVar

function cVar(expression: any): any

VBA: CVar

Variant に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cLngLng

function cLngLng(expression: any): long

VBA: CLngLng

LongLong(RAS の long)に変換する。64bit 版 Office のみ。

Microsoft のリファレンス

vba.d.ras

関数 cLngPtr

function cLngPtr(expression: any): ptr

VBA: CLngPtr

LongPtr(RAS の ptr)に変換する。

Microsoft のリファレンス

vba.d.ras

関数 cvErr

function cvErr(expression: any): cellValue

VBA: CVErr

指定したエラー番号を持つエラー値(Variant)を返す。

Microsoft のリファレンス

vba.d.ras

関数 abs

function abs(number: any): any

VBA: Abs

絶対値を返す。

Microsoft のリファレンス

vba.d.ras

関数 sgn

function sgn(number: any): int

VBA: Sgn

符号を -1 / 0 / 1 で返す。

Microsoft のリファレンス

vba.d.ras

関数 sqr

function sqr(number: double): double

VBA: Sqr

平方根を返す。

Microsoft のリファレンス

vba.d.ras

関数 int

function int(number: any): any

VBA: Int

小数部を取り除いた整数部分を返す。負の数ではより小さい整数になる。

Microsoft のリファレンス

vba.d.ras

関数 fix

function fix(number: any): any

VBA: Fix

小数部を取り除いた整数部分を返す。負の数では 0 に近い整数になる。

Microsoft のリファレンス

vba.d.ras

関数 round

function round(number: any, numDigitsAfterDecimal?: int): any

VBA: Round

指定した小数桁数に丸める。端数がちょうど 5 のときは偶数側に丸める(銀行丸め)。

Microsoft のリファレンス

vba.d.ras

関数 exp

function exp(number: double): double

VBA: Exp

e のべき乗を返す。

Microsoft のリファレンス

vba.d.ras

関数 log

function log(number: double): double

VBA: Log

自然対数を返す。

Microsoft のリファレンス

vba.d.ras

関数 sin

function sin(number: double): double

VBA: Sin

サイン(正弦)を返す。角度はラジアン。

Microsoft のリファレンス

vba.d.ras

関数 cos

function cos(number: double): double

VBA: Cos

コサイン(余弦)を返す。角度はラジアン。

Microsoft のリファレンス

vba.d.ras

関数 tan

function tan(number: double): double

VBA: Tan

タンジェント(正接)を返す。角度はラジアン。

Microsoft のリファレンス

vba.d.ras

関数 atn

function atn(number: double): double

VBA: Atn

アークタンジェント(逆正接)をラジアンで返す。

Microsoft のリファレンス

vba.d.ras

関数 rnd

function rnd(number?: any): float

VBA: Rnd

0 以上 1 未満の乱数を返す。

Microsoft のリファレンス

vba.d.ras

関数 randomize

function randomize(number?: any): void

VBA: Randomize

乱数ジェネレーターを初期化する。

Microsoft のリファレンス

vba.d.ras

関数 rgb

function rgb(red: int, green: int, blue: int): int

VBA: RGB

赤・緑・青の各成分(0 ~ 255)から RGB 値を作る。

Microsoft のリファレンス

vba.d.ras

関数 qbColor

function qbColor(color: int): int

VBA: QBColor

色番号(0 ~ 15)に対応する RGB 値を返す。

Microsoft のリファレンス

vba.d.ras

関数 now

function now(): date

VBA: Now

現在の日付と時刻を返す。

Microsoft のリファレンス

vba.d.ras

関数 date

function date(): date

VBA: Date

現在の日付を返す。

Microsoft のリファレンス

vba.d.ras

関数 time

function time(): date

VBA: Time

現在の時刻を返す。

Microsoft のリファレンス

vba.d.ras

関数 dateSerial

function dateSerial(year: int, month: int, day: int): date

VBA: DateSerial

年・月・日から日付を作る。

Microsoft のリファレンス

vba.d.ras

関数 timeSerial

function timeSerial(hour: int, minute: int, second: int): date

VBA: TimeSerial

時・分・秒から時刻を作る。

Microsoft のリファレンス

vba.d.ras

関数 dateValue

function dateValue(dateString: string): date

VBA: DateValue

日付を表す文字列を日付に変換する。

Microsoft のリファレンス

vba.d.ras

関数 timeValue

function timeValue(timeString: string): date

VBA: TimeValue

時刻を表す文字列を時刻に変換する。

Microsoft のリファレンス

vba.d.ras

関数 dateAdd

function dateAdd(interval: string, number: double, dateValue: any): date

VBA: DateAdd

日付に、指定した単位の時間間隔を加えた日付を返す。

Microsoft のリファレンス

vba.d.ras

関数 dateDiff

function dateDiff(interval: string, date1: any, date2: any, firstDayOfWeek?: VBA.VbDayOfWeek, firstWeekOfYear?: VBA.VbFirstWeekOfYear): int

VBA: DateDiff

2 つの日付の間隔を、指定した単位で数えて返す。

Microsoft のリファレンス

vba.d.ras

関数 datePart

function datePart(interval: string, dateValue: any, firstDayOfWeek?: VBA.VbDayOfWeek, firstWeekOfYear?: VBA.VbFirstWeekOfYear): int

VBA: DatePart

日付から、指定した単位(年・四半期・週など)の値を取り出す。

Microsoft のリファレンス

vba.d.ras

関数 year

function year(dateValue: any): int

VBA: Year

日付の年を返す。

Microsoft のリファレンス

vba.d.ras

関数 month

function month(dateValue: any): int

VBA: Month

日付の月(1 ~ 12)を返す。

Microsoft のリファレンス

vba.d.ras

関数 day

function day(dateValue: any): int

VBA: Day

日付の日(1 ~ 31)を返す。

Microsoft のリファレンス

vba.d.ras

関数 hour

function hour(timeValue: any): int

VBA: Hour

時刻の時(0 ~ 23)を返す。

Microsoft のリファレンス

vba.d.ras

関数 minute

function minute(timeValue: any): int

VBA: Minute

時刻の分(0 ~ 59)を返す。

Microsoft のリファレンス

vba.d.ras

関数 second

function second(timeValue: any): int

VBA: Second

時刻の秒(0 ~ 59)を返す。

Microsoft のリファレンス

vba.d.ras

関数 weekday

function weekday(dateValue: any, firstDayOfWeek?: VBA.VbDayOfWeek): int

VBA: Weekday

日付の曜日を番号(既定では日曜が 1)で返す。

Microsoft のリファレンス

vba.d.ras

関数 weekdayName

function weekdayName(weekday: int, abbreviate?: boolean, firstDayOfWeek?: VBA.VbDayOfWeek): string

VBA: WeekdayName

曜日番号に対応する曜日名を返す。

Microsoft のリファレンス

vba.d.ras

関数 monthName

function monthName(month: int, abbreviate?: boolean): string

VBA: MonthName

月番号に対応する月名を返す。

Microsoft のリファレンス

vba.d.ras

関数 dir

function dir(pathName?: any, attributes?: VBA.VbFileAttribute): string

VBA: Dir

パターンや属性に一致するファイル名を返す。引数なしで呼ぶと次の一致を返し、なくなると空文字列を返す。

Microsoft のリファレンス

vba.d.ras

関数 kill

function kill(pathName: any): void

VBA: Kill

ファイルを削除する。ワイルドカードを使える。

Microsoft のリファレンス

vba.d.ras

関数 fileCopy

function fileCopy(source: string, destination: string): void

VBA: FileCopy

ファイルをコピーする。

Microsoft のリファレンス

vba.d.ras

関数 fileLen

function fileLen(pathName: string): int

VBA: FileLen

ファイルのサイズ(バイト)を返す。

Microsoft のリファレンス

vba.d.ras

関数 fileDateTime

function fileDateTime(pathName: string): date

VBA: FileDateTime

ファイルの作成日時または最終更新日時を返す。

Microsoft のリファレンス

vba.d.ras

関数 getAttr

function getAttr(pathName: string): VBA.VbFileAttribute

VBA: GetAttr

ファイルやフォルダーの属性を返す。

Microsoft のリファレンス

vba.d.ras

関数 setAttr

function setAttr(pathName: string, attributes: VBA.VbFileAttribute): void

VBA: SetAttr

ファイルの属性を設定する。

Microsoft のリファレンス

vba.d.ras

関数 mkDir

function mkDir(path: string): void

VBA: MkDir

フォルダーを作成する。

Microsoft のリファレンス

vba.d.ras

関数 rmDir

function rmDir(path: string): void

VBA: RmDir

空のフォルダーを削除する。

Microsoft のリファレンス

vba.d.ras

関数 chDir

function chDir(path: string): void

VBA: ChDir

カレント フォルダーを変更する。

Microsoft のリファレンス

vba.d.ras

関数 chDrive

function chDrive(drive: string): void

VBA: ChDrive

カレント ドライブを変更する。

Microsoft のリファレンス

vba.d.ras

関数 curDir

function curDir(drive?: any): string

VBA: CurDir

カレント フォルダーのパスを返す。

Microsoft のリファレンス

vba.d.ras

関数 freeFile

function freeFile(rangeNumber?: any): int

VBA: FreeFile

次に使用できるファイル番号を返す。

Microsoft のリファレンス

vba.d.ras

関数 eof

function eof(fileNumber: int): boolean

VBA: EOF

開いているファイルの終端に達したかどうかを返す。

Microsoft のリファレンス

vba.d.ras

関数 lof

function lof(fileNumber: int): int

VBA: LOF

開いているファイルのサイズ(バイト)を返す。

Microsoft のリファレンス

vba.d.ras

関数 loc

function loc(fileNumber: int): int

VBA: Loc

開いているファイルの現在の位置を返す(forRandom は最後に読み書きしたレコード番号、forBinary は最後に読み書きしたバイトの位置、テキストのモードはバイト位置 ÷ 128)。

Microsoft のリファレンス

vba.d.ras

関数 fileAttr

function fileAttr(fileNumber: int, returnType?: int): int

VBA: FileAttr

開いているファイルのモード(returnType が 1 のとき。FileIO.OpenMode の値)を返す。

Microsoft のリファレンス

vba.d.ras

関数 objPtr

function objPtr(obj: any): ptr

VBA: ObjPtr

オブジェクトのインターフェイス ポインターを返す。

Microsoft のリファレンス

vba.d.ras

関数 strPtr

function strPtr(s: string): ptr

VBA: StrPtr

文字列バッファー(BSTR)のアドレスを返す。

Microsoft のリファレンス

vba.d.ras

関数 varPtr

function varPtr(v: any): ptr

VBA: VarPtr

変数のアドレスを返す。

Microsoft のリファレンス

vba.d.ras