This commit is contained in:
Kenichiro NOGI 2025-07-10 10:15:51 +09:00
parent 7176dc33ec
commit 4ff6e12165
97 changed files with 11777 additions and 0 deletions

View File

@ -0,0 +1,3 @@
{
"files.encoding": "shiftjis"
}

Binary file not shown.

View File

@ -0,0 +1,14 @@
{
"app_name": "XVBA",
"description": "",
"author": "",
"email": "",
"create_ate": "Thu May 29 2025 13:41:00 GMT+0900 (日本標準時)",
"excel_file": "MSSツール.xlsm",
"vba_folder": "vba-files",
"ribbon_file": "customUI14",
"ribbon_folder": "ribbons",
"logs": "on",
"xvba_packages": {},
"xvba_dev_packages": {}
}

View File

@ -0,0 +1,15 @@
{
"name": "xvba-app",
"version": "1.0.0",
"description": "A XVBA App",
"main": "index.js",
"author": "LocalSmart",
"license": "ISC",
"dependencies": {
"excel-types": "1.0.0",
"Xlog": "1.0.0"
},
"devDependencies": {
"@localsmart/xvba-cli": "^1.0.2"
}
}

View File

@ -0,0 +1,9 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet11"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet12"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet13"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet14"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet15"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet16"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet17"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet18"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet19"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,9 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "ThisWorkbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,529 @@
Attribute VB_Name = "Module1"
Option Explicit
'******************************************************************************
'シート名
Public shMSSdata As String
Public shMSSattach As String
Public shMSSlist1 As String
Public shMSSlist2 As String
Public shMSSattach2 As String
Public shMSSlist3 As String
Public thList As String
'共通変数F
Public keiyakuCode As String
Public workFolder As String
Public customerName As String
Public currentDirPath As String
Public apiKey As String
Public baseURL As String
'組織リスト
Public DeptsList As New Dictionary
'フォルダ名に使用できない文字一覧
Public invalidChars As String
'******************************************************************************
Function init()
'パブリック変数に値を格納
shMSSdata = "MSSデータ"
shMSSattach = "MSS添付"
shMSSlist1 = "MSSデータ一覧"
shMSSlist2 = "MSSリスト"
shMSSattach2 = "お客様データ添付"
shMSSlist3 = "お客様データリスト"
thList = "WF追加変更申請"
currentDirPath = Application.ThisWorkbook.Path
invalidChars = "<>/\\:*?" & Chr(34) & Chr(39) & Chr(0) & Chr(60) & Chr(62) & Chr(42) & Chr(124) & Chr(58) & Chr(160)
'Pleasanter API KEY
apiKey = "6504c8a807677a3a576e10327f3c19876c55736ee45d4a845796b9e7f5e087bfd4bd0d8184863da8cf1733ca635111432ab334aea59102b06a96ee6d2c05190d"
baseURL = "https://nextoffice.Next-hd.co.jp"
'ダウンロードファイルを保存するフォルダのパスを作成
Dim class200 As String
class200 = Range("レコード名").value
If class200 <> "" Then
'フォルダ名に使えない文字を削除
Dim i As Integer
For i = 1 To Len(invalidChars)
class200 = Replace(class200, Mid(invalidChars, i, 1), "")
Next i
'スペースをアンダースコアに置き換え
class200 = Replace(class200, " ", "")
class200 = Replace(class200, " ", "")
workFolder = class200
Else
workFolder = ""
End If
End Function
Sub getFileDownloadList1()
'Debug.Print ">>> 指定された添付ファイルを一括ダウンロード 開始"
Call init
Dim listCount As Long
Dim fileCount As Long
Dim hyplink As Hyperlink
'ダウンロードログ欄のクリア
Dim g1 As Long
g1 = 12
Dim g2 As Long
g2 = Worksheets(shMSSattach).Cells(Rows.count, 8).End(xlUp).Row
If g2 >= g1 Then
With Worksheets(shMSSattach).Range(Worksheets(shMSSattach).Cells(g1, 8), Worksheets(shMSSattach).Cells(g2, 8))
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
End If
'クリア
With Worksheets(shMSSattach).Range("H9")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
Worksheets(shMSSattach).Cells(g1, 8).value = "---ダウンロード開始---"
listCount = Worksheets(shMSSattach).Cells(Rows.count, 1).End(xlUp).Row
Dim i As Long
'添付ファイルシートより、DL指定されている項目からGuidリストを取得
For i = 2 To listCount
If Worksheets(shMSSattach).Cells(i, 6) = 1 Then
If Worksheets(shMSSattach).Cells(i, 5) > 0 Then
'**********************************
'顧客別フォルダが存在するか確認
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(currentDirPath & "\" & workFolder) Then
'ない場合はフォルダを作成
fso.CreateFolder (currentDirPath & "\" & workFolder)
End If
'保存ディレクトのリンク作成
Worksheets(shMSSattach).Range("H9").value = workFolder
Set hyplink = ActiveSheet.Hyperlinks.Add( _
Anchor:=Worksheets(shMSSattach).Range("H9"), _
Address:=workFolder)
'保存するディレクトリ確認
Dim saveFolderPath As String
Dim docName As String
Dim docNumber As String
docName = Worksheets(shMSSattach).Cells(i, 2).value '項目の名前
docNumber = Worksheets(shMSSattach).Cells(i, 1) '項目の番号
Dim charCount As Integer
For charCount = 1 To Len(invalidChars)
docName = Replace(docName, Mid(invalidChars, charCount, 1), "")
Next charCount
saveFolderPath = currentDirPath & "\" & workFolder & "\" & docNumber & "." & docName
'項目名フォルダが存在するか確認
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
Dim j As Long
j = Worksheets(shMSSattach).Cells(i, 4) '項目の列座標
fileCount = Worksheets(shMSSattach).Cells(Rows.count, j).End(xlUp).Row 'ファイルGuidリストの末尾行座標
'取得したGuidリストを元にダウンロード開始
Dim k As Long
For k = 4 To fileCount
Dim guid As String
Dim fileName As String
fileName = Worksheets(shMSSattach).Cells(k, j + 1).value
guid = Worksheets(shMSSattach).Cells(k, j).value
'Debug.Print "ファイルDL: " & fileName
'ダウンロード処理
Dim result As Boolean
result = getAttachmentsFile(guid, saveFolderPath)
'ダウンロード履歴保存
If result = True Then
g2 = Worksheets(shMSSattach).Cells(Rows.count, 8).End(xlUp).Row + 1
Worksheets(shMSSattach).Cells(g2, 8).value = docNumber & "." & docName & "\" & fileName
Set hyplink = ActiveSheet.Hyperlinks.Add( _
Anchor:=Worksheets(shMSSattach).Cells(g2, 8), _
Address:=workFolder & "\" & Worksheets(shMSSattach).Cells(g2, 8).value)
End If
Next k
End If
End If
Next i
g2 = Worksheets(shMSSattach).Cells(Rows.count, 8).End(xlUp).Row + 1
Worksheets(shMSSattach).Cells(g2, 8).value = "---ダウンロード終了---"
'Debug.Print "<<< 指定された添付ファイルを一括ダウンロード 終了"
End Sub
Sub getFileDownloadList2()
'Debug.Print ">>> 指定されたお客様データ添付ファイルを一括ダウンロード 開始"
Call init
Dim listCount As Long
Dim fileCount As Long
Dim hyplink As Hyperlink
'ダウンロードログ欄のクリア
Dim g1 As Long
g1 = 13
Dim g2 As Long
g2 = Worksheets(shMSSattach2).Cells(Rows.count, 2).End(xlUp).Row
If g2 >= g1 Then
With Worksheets(shMSSattach2).Range(Worksheets(shMSSattach2).Cells(g1, 2), Worksheets(shMSSattach2).Cells(g2, 2))
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
End If
'保存フォルダリンク クリア
With Worksheets(shMSSattach2).Range("B10")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
Worksheets(shMSSattach2).Cells(g1, 2).value = "---ダウンロード開始---"
listCount = Worksheets(shMSSlist3).Cells(Rows.count, 3).End(xlUp).Row
Dim i As Long
'お客様データリストシートより、DL指定されている項目からGuidリストを取得
For i = 4 To listCount
If Worksheets(shMSSlist3).Cells(i, 6) = 1 Then
If Worksheets(shMSSlist3).Cells(i, 5) > 0 Then
'**********************************
'顧客別フォルダが存在するか確認
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(currentDirPath & "\" & workFolder) Then
'ない場合はフォルダを作成
fso.CreateFolder (currentDirPath & "\" & workFolder)
End If
'保存フォルダリンク リンク作成
Worksheets(shMSSattach2).Range("B10").value = workFolder
Set hyplink = ActiveSheet.Hyperlinks.Add( _
Anchor:=Worksheets(shMSSattach2).Range("B10"), _
Address:=workFolder)
'保存するディレクトリ確認
Dim saveFolderPath As String
Dim docName As String
Dim docNumber As String
docName = Worksheets(shMSSlist3).Cells(i, 2).value '項目の名前
docNumber = Worksheets(shMSSlist3).Cells(i, 1) '項目の番号
Dim charCount As Integer
For charCount = 1 To Len(invalidChars)
docName = Replace(docName, Mid(invalidChars, charCount, 1), "")
Next charCount
saveFolderPath = currentDirPath & "\" & workFolder & "\" & docNumber & "." & docName
'項目名フォルダが存在するか確認
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
Dim j As Long
j = Worksheets(shMSSlist3).Cells(i, 4) '項目の列座標
fileCount = Worksheets(shMSSlist3).Cells(Rows.count, j).End(xlUp).Row 'ファイルGuidリストの末尾行座標
'取得したGuidリストを元にダウンロード開始
Dim k As Long
For k = 4 To fileCount
Dim guid As String
Dim fileName As String
fileName = Worksheets(shMSSlist3).Cells(k, j + 1).value
guid = Worksheets(shMSSlist3).Cells(k, j).value
'Debug.Print "ファイルDL: " & fileName
'ダウンロード処理
Dim result As Boolean
result = getAttachmentsFile(guid, saveFolderPath)
'ダウンロード履歴保存
If result = True Then
g2 = Worksheets(shMSSattach2).Cells(Rows.count, 2).End(xlUp).Row + 1
Worksheets(shMSSattach2).Cells(g2, 2).value = docNumber & "." & docName & "\" & fileName
Set hyplink = ActiveSheet.Hyperlinks.Add( _
Anchor:=Worksheets(shMSSattach2).Cells(g2, 2), _
Address:=workFolder & "\" & Worksheets(shMSSattach2).Cells(g2, 2).value)
End If
Next k
End If
End If
Next i
g2 = Worksheets(shMSSattach2).Cells(Rows.count, 2).End(xlUp).Row + 1
Worksheets(shMSSattach2).Cells(g2, 2).value = "---ダウンロード終了---"
'Debug.Print "<<< 指定されたお客様データ添付ファイルを一括ダウンロード 終了"
End Sub
'プリザンターのユーザー情報一覧取得
Sub getPleasanterUsers()
Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
'Debug.Print ">>> プリザンターのユーザー情報一覧取得 開始"
Dim sh As Worksheet
Set sh = Worksheets("マスターデータ")
sh.ListObjects("社員リスト").DataBodyRange.Delete
sh.ListObjects("組織リスト").DataBodyRange.Delete
Call init
Call getPleasanterDeptsRequest(0)
Call getPleasanterUsersRequest(0)
Application.Calculation = xlAutomatic '自動計算開始
Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< プリザンターのユーザー情報一覧取得 終了"
End Sub
Function getPleasanterUsersRequest(offset)
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/users/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
apiBody.Add "Offset", offset
'Filter変数
Dim colSorter As New Dictionary
colSorter.Add "UserId", "asc"
'View変数
Dim view As New Dictionary
view.Add "ColumnSorterHash", colSorter
apiBody.Add "View", view
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
If res("StatusCode") = 200 Then
'正常に取得できたらシートへ書き込み
'Call exportToSheetData(res)
'Debug.Print JsonConverter.ConvertToJson(res("Response")("TotalCount"))
'Debug.Print JsonConverter.ConvertToJson(res("Response")("PageSize"))
'Debug.Print JsonConverter.ConvertToJson(res("Response")("Offset"))
'Debug.Print JsonConverter.ConvertToJson(res("Response")("Data").count)
'Debug.Print "----- 取得成功"
Call exportUsersList(res)
End If
'200以上の場合は再実行
If res("Response")("PageSize") + res("Response")("Offset") < res("Response")("TotalCount") Then
Call getPleasanterUsersRequest(offset + 200)
End If
End Function
'マスターデータシートの社員リストテーブルを更新
Function exportUsersList(res)
Dim value
Dim N As Long
Dim sh As Worksheet
Set sh = Worksheets("マスターデータ")
For Each value In res("Response")("Data")
'Debug.Print value("UserId") & " " & value("LoginId") & " " & value("Name")
sh.ListObjects("社員リスト").ListRows.Add
N = sh.ListObjects("社員リスト").ListRows.count
With sh.ListObjects("社員リスト").ListRows(N)
.Range(1) = value("UserId")
.Range(2) = value("LoginId")
.Range(3) = value("Name")
.Range(4) = value("DeptCode")
.Range(5) = DeptsList(value("DeptCode"))
.Range(6) = ""
End With
Next value
End Function
Function getPleasanterDeptsRequest(offset)
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/depts/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
apiBody.Add "Offset", offset
'Filter変数
Dim colSorter As New Dictionary
colSorter.Add "DeptId", "asc"
'View変数
Dim view As New Dictionary
view.Add "ColumnSorterHash", colSorter
apiBody.Add "View", view
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
If res("StatusCode") = 200 Then
'正常に取得できたらシートへ書き込み
'Call exportToSheetData(res)
'Debug.Print JsonConverter.ConvertToJson(res("Response")("TotalCount"))
'Debug.Print JsonConverter.ConvertToJson(res("Response")("PageSize"))
'Debug.Print JsonConverter.ConvertToJson(res("Response")("Offset"))
'Debug.Print JsonConverter.ConvertToJson(res("Response")("Data").count)
'Debug.Print "----- 取得成功"
Call exportDeptsList(res)
End If
'200以上の場合は再実行
If res("Response")("PageSize") + res("Response")("Offset") < res("Response")("TotalCount") Then
Call getPleasanterDeptsRequest(offset + 200)
End If
End Function
'マスターデータシートの組織リストを更新
Function exportDeptsList(res)
Dim value
Dim N As Long
Dim sh As Worksheet
Set sh = Worksheets("マスターデータ")
For Each value In res("Response")("Data")
DeptsList.Add value("DeptCode"), value("DeptName")
sh.ListObjects("組織リスト").ListRows.Add
N = sh.ListObjects("組織リスト").ListRows.count
With sh.ListObjects("組織リスト").ListRows(N)
.Range(1) = value("DeptId")
.Range(2) = value("DeptCode")
.Range(3) = value("DeptName")
.Range(4) = value("Body")
End With
Next value
End Function
Sub SheetToPdfSave1()
Call SheetToPdfSave("覚書", "覚書【閲覧専用】")
End Sub
Sub SheetToPdfSave2()
Call SheetToPdfSave("粗利益確認書(設計契約)", "粗利益確認書(設計契約)【閲覧専用】")
End Sub
Sub SheetToPdfSave3()
Call SheetToPdfSave("粗利益確認書(本契約)", "粗利益確認書(本契約)【閲覧専用】")
End Sub
'指定したシートを名前をつけてPDF保存
Function SheetToPdfSave(shName, fileName)
Call init
'**********************************
'顧客別フォルダが存在するか確認
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(currentDirPath & "\" & workFolder) Then
'ない場合はフォルダを作成
fso.CreateFolder (currentDirPath & "\" & workFolder)
End If
Dim filePath
filePath = ThisWorkbook.Path & "\"
Dim fileName2
fileName2 = workFolder & "■" & fileName
'保存先
Dim saveFile
saveFile = filePath & workFolder & "\" & fileName2 & ".pdf"
Debug.Print saveFile
Worksheets(shName).Range("A1").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, fileName:=saveFile _
, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Function

View File

@ -0,0 +1,272 @@
Attribute VB_Name = "Module2"
Option Explicit
'##########################################################################################################
' selectKeiyakuCode
'   契約コードを選択し、データを1件分取得
' getMSSdataRequest
'   お客様データファイルの一覧取得リクエスト
' exportToSheetData
'   取得したファイル情報をシートに保存
'******************************************************************************
'リストから契約コードを選択する
Sub selectKeiyakuCode()
Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
Call init
'Debug.Print ">>> MSSからデータを1件取得する処理を開始します"
Dim Ad As String 'セル番号用変数
Dim Col As Integer 'セルの列番号用変数
Dim Row As Integer 'セルの行番号用変数
Ad = ActiveCell.Address
Col = ActiveCell.Column
Row = ActiveCell.Row
Range("レコードID").value = ""
Range("レコードタイトル").value = ""
'テーブル範囲無いにカーソルがあるときにボタンを押したら、契約コードを取得する
If Row >= 3 And Row <= 104 And Col >= 4 And Col <= 19 Then
Dim keiyakuCode As Variant
keiyakuCode = Worksheets(shMSSlist1).Cells(Row, 13).value
'Debug.Print keiyakuCode
If keiyakuCode <> 0 Then
Range("契約コード指定").value = keiyakuCode
Else
Range("契約コード指定").value = ""
Range("レコードID").value = ""
Range("レコードタイトル").value = ""
End If
End If
If Range("契約コード指定").value <> "" Then
'テーブル外にカーソルがあるとき、個別契約コードに値があったら実行
If Range("契約コード指定").value = "9999AAABB" Then
MsgBox "契約コード【9999AAABB】は選択不可"
Else
Call getMSSdataRequest(Range("契約コード指定").value)
End If
Else
MsgBox "取得したい情報をリストから選択してください"
End If
Application.Calculation = xlAutomatic '自動計算開始
Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< MSSからデータを1件取得する処理を終了しました"
End Sub
'******************************************************************************
'プリザンターマスターシートから単体データを取得する
Function getMSSdataRequest(ByVal keiyakuCode As String)
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'MSSテーブルID
tableId = "189112"
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/items/" & tableId & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'Filter変数
Dim colFilter As New Dictionary
colFilter.Add "ClassA", keiyakuCode
'View変数
Dim view As New Dictionary
view.Add "ColumnFilterHash", colFilter
apiBody.Add "View", view
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
If res("StatusCode") = 200 And res("Response")("TotalCount") = 1 Then
'グローバル変数へ情報格納
keiyakuCode = res("Response")("Data")(1)("ClassHash")("ClassA")
'正常に取得できたらシートへ書き込み
'Debug.Print "個別情報 取得成功"
Call exportToSheetData(res)
End If
End Function
'******************************************************************************
'プリザンターマスターシートから取得したデータをシートに書き込む
Function exportToSheetData(res As Object)
Dim itemTitle As String
Dim resultId As String
itemTitle = res("Response")("Data")(1)("ItemTitle")
Range("レコードタイトル").value = itemTitle
resultId = res("Response")("Data")(1)("ResultId")
Range("レコードID").value = resultId
Dim key, g
g = 2
For Each key In res("Response")("Data")(1)
If IsObject(res("Response")("Data")(1)(key)) Then
'中身がHashの場合は飛ばす
Else
Worksheets(shMSSdata).Cells(g, 26) = key
Worksheets(shMSSdata).Cells(g, 27) = res("Response")("Data")(1)(key)
g = g + 1
End If
Next key
'最終行を取得
Dim lastRow As Long
Dim hashNameList As New Dictionary
hashNameList.Add 2, "ClassHash"
hashNameList.Add 5, "NumHash"
hashNameList.Add 8, "DateHash"
hashNameList.Add 11, "DescriptionHash"
hashNameList.Add 14, "CheckHash"
hashNameList.Add 17, "AttachmentsHash"
Dim j As Long
j = 2
For j = 2 To 14 Step 3
'事前にセルをクリア
Worksheets(shMSSdata).Columns(j + 2).ClearContents
'Hashリスト名
Dim hashName As String
hashName = hashNameList(j)
lastRow = Worksheets(shMSSdata).Cells(Rows.count, j).End(xlUp).Row
Dim i As Long
For i = 2 To lastRow
'セル値を取得
Dim colName As String
colName = Worksheets(shMSSdata).Cells(i, j).value
Dim data As Variant
data = res("Response")("Data")(1)(hashName)(colName)
'日付の場合は下処理
If hashName = "DateHash" Then
If data = "1899-12-30T00:00:00" Then
data = ""
Else
data = Replace(data, "T", " ")
End If
End If
Worksheets(shMSSdata).Cells(i, j + 2) = data
Next i
Next j
'******************************************************************************
'添付ファイルデータ処理
'事前にセルをクリア
Worksheets(shMSSattach).Range("L4:DD100").ClearContents
'ダウンロードログ欄のクリア
Dim g1 As Long
g1 = 12
Dim g2 As Long
g2 = Worksheets(shMSSattach).Cells(Rows.count, 8).End(xlUp).Row
If g2 >= g1 Then
With Worksheets(shMSSattach).Range(Worksheets(shMSSattach).Cells(g1, 8), Worksheets(shMSSattach).Cells(g2, 8))
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
End If
'クリア
With Worksheets(shMSSattach).Range("H9")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
hashName = hashNameList(j)
Dim jj As Long
jj = 3
lastRow = Worksheets(shMSSattach).Cells(Rows.count, jj).End(xlUp).Row
For i = 2 To lastRow
'セル値を取得
colName = Worksheets(shMSSattach).Cells(i, jj).value
Dim rowNum As Long
rowNum = Worksheets(shMSSattach).Cells(i, jj + 1).value
If res("Response")("Data")(1)(hashName).Exists(colName) = True Then
Dim k As Long
For k = 1 To res("Response")("Data")(1)(hashName)(colName).count
Dim l As Long
l = (k - 1) * 2
''Debug.Print res("Response")("Data")(1)(hashName)(colName)(k)("Guid")
''Debug.Print res("Response")("Data")(1)(hashName)(colName)(k)("Name")
Worksheets(shMSSattach).Cells(k + 3, rowNum) = res("Response")("Data")(1)(hashName)(colName)(k)("Guid")
Worksheets(shMSSattach).Cells(k + 3, rowNum + 1) = res("Response")("Data")(1)(hashName)(colName)(k)("Name")
Next k
End If
Next i
'******************************************************************************
'お客様データのGuid保管エリアのクリア
'事前にセルをクリア
Worksheets(shMSSlist3).Range("L4:ZZ100").ClearContents
'ダウンロードログ欄のクリア
'Dim g1 As Long
g1 = 13
'Dim g2 As Long
g2 = Worksheets(shMSSattach2).Cells(Rows.count, 2).End(xlUp).Row
If g2 >= g1 Then
With Worksheets(shMSSattach2).Range(Worksheets(shMSSattach2).Cells(g1, 2), Worksheets(shMSSattach2).Cells(g2, 2))
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
End If
'保存フォルダリンク クリア
With Worksheets(shMSSattach2).Range("B10")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
'お客様データファイルの取得
Call getMSSfilesList
'その他データの取得
Call getOtherData
Call jsonToSheetTest
End Function

View File

@ -0,0 +1,250 @@
Attribute VB_Name = "Module3"
Option Explicit
'##########################################################################################################
' getMSSlist
'   MSS案件一覧の取得
' getMSSlistRequest
'   プリザンターマスターシートから指定営業所の全データを取得する
' exportToMSSlist
'   プリザンターマスターシートから取得したリストデータを書き込む
'******************************************************************************
'MSSからデータをリストで取得する
Sub getMSSlist()
Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
Call init
'Debug.Print ">>> MSSからデータをリストで取得する処理を開始します"
'MSSデータ一覧から営業所を取得
Dim shopName As String
Dim shopCode As String
Dim statusName As String
Dim statusCode As String
shopName = Range("営業所指定").value
statusName = Range("ステータス").value
'営業所とステータスはどちらか必ず指定
If shopName = "" And statusName = "" Then
Range("営業所指定").Select
MsgBox "営業所かステータスを指定してください"
Else
'契約コードの個別指定欄を空欄にしてからリスト取得実行
'Range("契約コード").Value = ""
Call getMSSlistRequest
End If
Application.Calculation = xlAutomatic '自動計算開始
Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< MSSからデータをリストで取得する処理を終了しました"
End Sub
'******************************************************************************
'プリザンターマスターシートから指定営業所の全データを取得する
Function getMSSlistRequest()
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'MSSテーブルID
tableId = "189112"
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/items/" & tableId & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'条件日付作成
Dim currentDate As Date
currentDate = Date
'直近月数を取得し、日付を計算
Dim delayMonth As Integer
If Range("直近").value = "" Then
Range("直近").value = 1
delayMonth = -1
Else
delayMonth = (-1) * Range("直近").value
End If
Dim previousYearDate As Date
previousYearDate = DateAdd("m", delayMonth, currentDate)
'文字列に変換
Dim previousYearDateString As String
previousYearDateString = Format(previousYearDate, "yyyy/mm/dd")
previousYearDateString = previousYearDateString & " 00:00:00"
'Debug.Print previousYearDateString
'Filter変数
Dim colFilter As New Dictionary
Dim shopID As String
Dim statusID As String
Dim salesID As String
Dim yakuinID As String
Dim sekkeiID As String
Dim bunruiID As String
shopID = Range("営業所ID")
statusID = Range("ステータスID")
salesID = Range("営業ID")
sekkeiID = Range("設計ID")
yakuinID = Range("役員ID")
bunruiID = Range("シート分類ID")
If shopID <> "" Then
colFilter.Add "ClassF", "[" & shopID & "]"
End If
If statusID <> "" Then
colFilter.Add "Status", "[" & statusID & "]"
End If
If salesID <> "" Then
colFilter.Add "ClassG", "[" & salesID & "]"
End If
If sekkeiID <> "" Then
colFilter.Add "ClassL", "[" & sekkeiID & "]"
End If
If yakuinID <> "" Then
colFilter.Add "Class122", "[" & yakuinID & "]"
End If
If bunruiID <> "" Then
colFilter.Add "ClassP", "[" & bunruiID & "]"
End If
colFilter.Add "UpdatedTime", "[""" & previousYearDateString & ",""]"
Dim colSorter As New Dictionary
colSorter.Add "Status", "asc"
colSorter.Add "ClassG", "asc"
'View変数
Dim view As New Dictionary
view.Add "ColumnFilterHash", colFilter
view.Add "ColumnSorterHash", colSorter
apiBody.Add "View", view
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
If res("StatusCode") = 200 Then
'正常に取得できたらシートへ書き込み
'Call exportToSheetData(res)
'Debug.Print JsonConverter.ConvertToJson(res("Response")("TotalCount"))
'Debug.Print "MSSデータリスト 取得成功"
Call exportToMSSlist(res)
End If
End Function
'******************************************************************************
'プリザンターマスターシートから取得したリストデータを書き込む
Function exportToMSSlist(res As Object)
'リストのクリア
Worksheets(shMSSlist2).Range("B3:AZ100").ClearContents
'ステータス Status
'タイトル ItemTitle
'シート分類 ClassP*
'契約営業所 ClassF*
'主担当営業 ClassG*
'管理設計 ClassL
'所属長 ClassY
'担当役員 Class122
'契約コード ClassA
'設計契約 ClassN*
'契約ブランド Class033*
'工事名 ClassQ
'本契約日 DateD
'設計契約日 DateE
'着工予定日 DateH
'上棟予定日 DateJ
'引渡予定日 DateL
'最終更新日 UpdatedTime
Dim dataCount As Long
dataCount = res("Response")("TotalCount")
If dataCount = 0 Then
Exit Function
End If
''Debug.Print JsonConverter.ConvertToJson(res("Response")("Data"))
Dim i As Long
For i = 1 To dataCount
Dim j As Long: j = 2
Dim dataArray() As Variant
ReDim dataArray(1)
dataArray(1) = res("Response")("Data")(i)("ResultId")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("Status")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ItemTitle")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassP")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassF")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassG")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassL")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassY")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("Class122")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassA")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassN")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("Class033")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = res("Response")("Data")(i)("ClassHash")("ClassQ")
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = stringToDate(res("Response")("Data")(i)("DateHash")("DateD"))
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = stringToDate(res("Response")("Data")(i)("DateHash")("DateE"))
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = stringToDate(res("Response")("Data")(i)("DateHash")("DateH"))
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = stringToDate(res("Response")("Data")(i)("DateHash")("DateJ"))
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = stringToDate(res("Response")("Data")(i)("DateHash")("DateL"))
ReDim Preserve dataArray(UBound(dataArray) + 1)
dataArray(UBound(dataArray)) = stringToDate(res("Response")("Data")(i)("UpdatedTime"))
Dim k As Long
For k = 0 To UBound(dataArray)
Worksheets(shMSSlist2).Cells(i + 2, k + 1) = dataArray(k)
Next k
Next i
End Function
Function stringToDate(ByVal dateVal As String) As Variant
If dateVal = "1899-12-30T00:00:00" Then
stringToDate = ""
Else
stringToDate = CDate(Replace(dateVal, "T", " "))
End If
End Function

View File

@ -0,0 +1,237 @@
Attribute VB_Name = "Module4"
Option Explicit
'##########################################################################################################
' callRestApi
'   restAPIリクエスト汎用関数
' getAttachmentsFile
'   添付ファイル
' exportFileList
'   取得したファイル情報をシートに保存
'******************************************************************************
'REST API呼出処理
' method GetかPOSTか
' url REST APIのURL
' urlParam リクエストパラメータオプション
' headers ヘッダオプション
Function callRestApi(ByVal method As String, ByVal url As String, Optional ByVal urlParam As String = "", Optional ByVal headers As Dictionary = Null, Optional ByVal body As Dictionary = Null) As Object
'HTTPリクエストのオブジェクトを定義
Dim objHTTP As Object
Set objHTTP = New XMLHTTP60
'HTTPリクエストの接続先を設定
objHTTP.Open method, url & urlParam, False
'リクエストヘッダーを設定複数ある場合はsetRequestHeaderを複数書けば良いのだ
Dim i As Long
For i = 0 To headers.count - 1
objHTTP.setRequestHeader headers.keys(i), headers.items(i)
Next i
'リクエスト送信
objHTTP.send JsonConverter.ConvertToJson(body)
Do While objHTTP.readyState < 4
DoEvents
Loop
'レスポンスの文字列objHTTP.responseTextをJsonに変換して返却
Set callRestApi = JsonConverter.ParseJson(objHTTP.responseText)
End Function
'******************************************************************************
'guidから添付ファイルのバイナリデータを取得する
Function getAttachmentsFile(guid As String, saveFolderPath As String) As Boolean
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/binaries/" & guid & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
If res("StatusCode") = 200 Then
'ダウンロードしたBase64データをファイル保存
Dim base64Data As String
base64Data = res("Response")("Base64")
'**********************************
'保存するファイルパスを入力
Dim saveFilePath As String
saveFilePath = saveFolderPath & "\" & res("Response")("FileName")
'**********************************
'Base64データをデコードして保存
Dim ret As Long
ret = DecodeBase64(base64Data, saveFilePath)
'完了メッセージを表示
Debug.Print "ファイルの保存に成功しました:" & saveFilePath & ":" & ret
If ret = -1 Then
getAttachmentsFile = True
End If
End If
End Function
'******************************************************************************
' Base64デコードしてファイル名をつけて保存する上書き
'------------------------------------------------------------------------------
' 引数Base64の文字列 第2引数保存ファイル名
'******************************************************************************
Function DecodeBase64(ByVal Base64Str As String, ByVal filePath As String) As Long
'ファイルをBase64デコード
Dim elm As Object
Dim ret As Long
Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2
ret = -1 '初期化
On Error Resume Next
Set elm = CreateObject("MSXML2.DOMDocument").createElement("base64")
elm.DataType = "bin.base64"
elm.text = Base64Str
With CreateObject("ADODB.Stream")
.Type = adTypeBinary
.Open
.Write elm.nodeTypedValue
.SaveToFile filePath, adSaveCreateOverWrite
.Close
End With
If Err.Number <> 0 Then ret = 0
On Error GoTo 0
DecodeBase64 = ret
End Function
Sub jsonToSheetTest()
Dim jsonStr As String
Dim targetSheet As String
Dim targetCol As String
'保管するシート名
targetSheet = "JSONデータ"
'読み込むデータと吐き出す位置
jsonStr = Range("契約会社json").value
targetCol = 2
Call jsonToSheet(jsonStr, targetSheet, targetCol)
jsonStr = Range("施工会社json").value
targetCol = 4
Call jsonToSheet(jsonStr, targetSheet, targetCol)
jsonStr = Range("契約営業所json").value
targetCol = 6
Call jsonToSheet(jsonStr, targetSheet, targetCol)
jsonStr = Range("契約ブランドjson").value
targetCol = 8
Call jsonToSheet(jsonStr, targetSheet, targetCol)
jsonStr = Range("シリーズjson").value
targetCol = 10
Call jsonToSheet(jsonStr, targetSheet, targetCol)
jsonStr = Range("支払情報JSON").value
targetCol = 14
Call jsonToSheet2(jsonStr, targetSheet, targetCol)
End Sub
'******************************************************************************
'json文字列を分解し、指定したシート・セルの位置に展開する
Function jsonToSheet(ByVal jsonStr As String, ByVal targetSheet As String, ByVal targetCol As Long)
Debug.Print ">>> Json文字列を分析し、シートに書き出す"
Dim jsonObj As Object
Dim key1, key2
Dim item1, item2
Dim i
i = 3
'データクリア
With Worksheets(targetSheet)
.Range(.Cells(i, targetCol), .Cells(1000, targetCol + 1)).ClearContents
End With
'JSON文字列が空文字の場合終了
If jsonStr = "" Then
Exit Function
End If
'デシリアライズ
Set jsonObj = JsonConverter.ParseJson(jsonStr)
For Each key1 In jsonObj
If IsObject(jsonObj(key1)) Then
'中身がオブジェクトの場合はもう一度分解
For Each key2 In jsonObj(key1)
item2 = jsonObj(key1)(key2)
Worksheets(targetSheet).Cells(i, targetCol) = key2
Worksheets(targetSheet).Cells(i, targetCol + 1) = item2
i = i + 1
Next key2
Else
item1 = jsonObj(key1)
Worksheets(targetSheet).Cells(i, targetCol) = key1
Worksheets(targetSheet).Cells(i, targetCol + 1) = item1
i = i + 1
End If
Next key1
End Function
'******************************************************************************
'json文字列を分解し、指定したシート・セルの位置に展開する その2
'配列タイプ
Function jsonToSheet2(ByVal jsonStr As String, ByVal targetSheet As String, ByVal targetCol As Long)
Debug.Print ">>> Json文字列を分析し、シートに書き出す その2"
Dim jsonObj As Object
Set jsonObj = JsonConverter.ParseJson(jsonStr)
Dim key1, item1
Dim obj
Dim i, j
i = 3
For Each obj In jsonObj
j = targetCol
For Each key1 In obj
item1 = obj(key1)
Worksheets(targetSheet).Cells(i, j) = item1
j = j + 1
Next key1
i = i + 1
Next obj
End Function

View File

@ -0,0 +1,129 @@
Attribute VB_Name = "Module5"
Option Explicit
'##########################################################################################################
' getMSSfilesList
'   お客様データファイルのリストダウンロード
' getMSSfilesListRequest
'   お客様データファイルの一覧取得リクエスト
' exportFileList
'   取得したファイル情報をシートに保存
'******************************************************************************
'お客様データの一覧を取得
Sub getMSSfilesList()
Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
Call init
'Debug.Print ">>> お客様データファイルのリストダウンロード 開始"
'//
Dim recordId As String
recordId = Range("お客様データID").value
If recordId <> "" And recordId <> "212512" Then
Call getMSSfilesListRequest(recordId)
End If
Application.Calculation = xlAutomatic '自動計算開始
Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< お客様データファイルのリストダウンロード 終了"
End Sub
'******************************************************************************
'お客様データの一覧を取得リクエスト送信
Function getMSSfilesListRequest(ByVal recordId As String)
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/items/" & recordId & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
If res("StatusCode") = 200 And res("Response")("TotalCount") = 1 Then
'正常に取得できたらシートへ書き込み
'Debug.Print "お客様データ 取得成功"
Call exportFileList(res)
End If
End Function
Function exportFileList(res)
'事前にセルをクリア
Worksheets(shMSSlist3).Range("L4:ZZ100").ClearContents
'ダウンロードログ欄のクリア
Dim g1 As Long
g1 = 13
Dim g2 As Long
g2 = Worksheets(shMSSattach2).Cells(Rows.count, 2).End(xlUp).Row
If g2 >= g1 Then
With Worksheets(shMSSattach2).Range(Worksheets(shMSSattach2).Cells(g1, 2), Worksheets(shMSSattach2).Cells(g2, 2))
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
End If
'保存フォルダリンク クリア
With Worksheets(shMSSattach2).Range("B10")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
Dim i As Long
Dim colNum As Long
Dim hashName As String
Dim colLabel As String
Dim colName As String
Dim lastRow As Long
lastRow = Worksheets(shMSSlist3).Cells(Rows.count, 3).End(xlUp).Row
hashName = "AttachmentsHash"
For i = 4 To lastRow
colLabel = Worksheets(shMSSlist3).Cells(i, 2).value
colName = Worksheets(shMSSlist3).Cells(i, 3).value
colNum = Worksheets(shMSSlist3).Cells(i, 4).value
If res("Response")("Data")(1)(hashName).Exists(colName) = True Then
Dim k As Long
For k = 1 To res("Response")("Data")(1)(hashName)(colName).count
Dim l As Long
l = (k - 1) * 2
'添付ファイルリスト
Worksheets(shMSSlist3).Cells(k + 3, colNum) = res("Response")("Data")(1)(hashName)(colName)(k)("Guid")
Worksheets(shMSSlist3).Cells(k + 3, colNum + 1) = res("Response")("Data")(1)(hashName)(colName)(k)("Name")
Next k
End If
Next i
End Function

View File

@ -0,0 +1,390 @@
Attribute VB_Name = "Module6"
Option Explicit
'粗利益確認書データインポート
Sub getArariDataTest()
Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
Call init
'Debug.Print ">>> 粗利益確認書のダウンロード 開始"
Dim resultId As String
resultId = Range("ResultId").value
If resultId <> "" Then
'Debug.Print resultId
Call getArariDataRequest(resultId)
End If
Application.Calculation = xlAutomatic '自動計算開始
Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< 粗利益確認書のダウンロード 終了"
End Sub
'MSSマスターシートのIDを指定して、粗利益確認書のデータを取得する
Function getArariDataRequest(classA)
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'粗利益確認書テーブルID
tableId = "189113"
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/items/" & tableId & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'Filter変数
Dim colFilter As New Dictionary
colFilter.Add "ClassA", "[" & classA & "]"
'View変数
Dim view As New Dictionary
view.Add "ColumnFilterHash", colFilter
apiBody.Add "View", view
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
'Debug.Print res("StatusCode")
'Debug.Print res("Response")("TotalCount")
If res("StatusCode") = 200 And res("Response")("TotalCount") = 1 Then
'グローバル変数へ情報格納
'Debug.Print res("StatusCode")
''Debug.Print res("Response")("TotalCount")
''Debug.Print res("Response")("Data")(1)("DescriptionHash")("DescriptionA")
'正常に取得できたらシートへ書き込み
'Debug.Print "粗利益確認書 取得成功"
Call exportArariData(res)
End If
End Function
'粗利益データをシートに出力する
Function exportArariData(res)
'Debug.Print "<< 粗利益確認書 出力開始"
Dim arariSh
'既存データのクリア
Set arariSh = Worksheets("粗利益確認書(本契約)")
arariSh.Range("F11:G11").ClearContents '本体金額
arariSh.Range("C12:G21").ClearContents '付帯工事
arariSh.Range("L24").ClearContents '利益率(%)
arariSh.Range("C25:I34").ClearContents '本体工事内上乗せ
arariSh.Range("C37:I46").ClearContents '確定付帯上乗せ
arariSh.Range("C49:I58").ClearContents 'サービス項目
arariSh.Range("G59:I59").ClearContents '紹介料
arariSh.Range("F60:G60").ClearContents '値引き
arariSh.Range("C63:I72").ClearContents 'その他工事
arariSh.Range("G80").ClearContents '積算チェック 追加変更
Set arariSh = Worksheets("粗利益確認書(設計契約)")
arariSh.Range("F11:G11").ClearContents '本体金額
arariSh.Range("C12:G21").ClearContents '付帯工事
arariSh.Range("L24").ClearContents '利益率(%)
arariSh.Range("C25:I34").ClearContents '本体工事内上乗せ
arariSh.Range("C37:I46").ClearContents '確定付帯上乗せ
arariSh.Range("C49:I58").ClearContents 'サービス項目
arariSh.Range("G59:I59").ClearContents '紹介料
arariSh.Range("F60:G60").ClearContents '値引き
arariSh.Range("C63:I72").ClearContents 'その他工事
arariSh.Range("G80").ClearContents '積算チェック 追加変更
'本契約粗利益確認書格納変数
Dim descA, descB, desc002, descD, descF, descH, descI, descJ, descL, desc008 As String
Dim descAdata, descBdata, desc002data, descDdata, descFdata, descHdata, descIdata, descJdata, descLdata, desc008data As Object
descA = res("Response")("Data")(1)("DescriptionHash")("DescriptionA") 'A.本体価格
descB = res("Response")("Data")(1)("DescriptionHash")("DescriptionB") 'B.付帯項目
desc002 = res("Response")("Data")(1)("DescriptionHash")("Description002") '002.中計1
descD = res("Response")("Data")(1)("DescriptionHash")("DescriptionD") 'D.本体工事内上乗せ
descF = res("Response")("Data")(1)("DescriptionHash")("DescriptionF") 'F.確定付帯工事
descH = res("Response")("Data")(1)("DescriptionHash")("DescriptionH") 'H.サービス項目
descI = res("Response")("Data")(1)("DescriptionHash")("DescriptionI") 'I.紹介料
descJ = res("Response")("Data")(1)("DescriptionHash")("DescriptionJ") 'J.サービス項目 値引き
descL = res("Response")("Data")(1)("DescriptionHash")("DescriptionL") 'L.その他工事
desc008 = res("Response")("Data")(1)("DescriptionHash")("Description008") '008.積算チェック
Set descAdata = JsonConverter.ParseJson(descA)
Set descBdata = JsonConverter.ParseJson(descB)
Set desc002data = JsonConverter.ParseJson(desc002)
Set descDdata = JsonConverter.ParseJson(descD)
Set descFdata = JsonConverter.ParseJson(descF)
Set descHdata = JsonConverter.ParseJson(descH)
Set descIdata = JsonConverter.ParseJson(descI)
Set descJdata = JsonConverter.ParseJson(descJ)
Set descLdata = JsonConverter.ParseJson(descL)
Set desc008data = JsonConverter.ParseJson(desc008)
Dim xx As Long
Dim value
'本契約粗利益確認書
Set arariSh = Worksheets("粗利益確認書(本契約)")
arariSh.Cells(1, 18) = res("Response")("Data")(1)("ResultId")
'------------------------------------------------------------
'本体金額
xx = 11
For Each value In descAdata
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
Next value
'------------------------------------------------------------
'付帯工事
xx = 12
For Each value In descBdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
If xx = 22 Then
Exit For
End If
Next value
'------------------------------------------------------------
'中計1 利益率
xx = 24
For Each value In desc002data
arariSh.Cells(xx, 12) = value("7")
xx = xx + 1
Next value
'------------------------------------------------------------
'本体工事内上乗せ
xx = 25
For Each value In descDdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 35 Then
Exit For
End If
Next value
'------------------------------------------------------------
'確定付帯上乗せ
xx = 37
For Each value In descFdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 47 Then
Exit For
End If
Next value
'------------------------------------------------------------
'サービス項目
xx = 49
For Each value In descHdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 59 Then
Exit For
End If
Next value
'------------------------------------------------------------
'紹介料
xx = 59
For Each value In descIdata
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
Next value
'------------------------------------------------------------
'値引き
xx = 60
For Each value In descJdata
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
Next value
'------------------------------------------------------------
'その他項目
xx = 63
For Each value In descLdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 73 Then
Exit For
End If
Next value
'------------------------------------------------------------
'積算チェック
xx = 80
For Each value In desc008data
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
Next value
'------------------------------------------------------------
'設計契約粗利益確認書格納変数
Dim desc021, desc022, desc042, desc024, desc026, desc028, desc029, desc030, desc032, desc048 As String
desc021 = res("Response")("Data")(1)("DescriptionHash")("Description021") 'S_A.本体価格
desc022 = res("Response")("Data")(1)("DescriptionHash")("Description022") 'S_B.付帯項目
desc042 = res("Response")("Data")(1)("DescriptionHash")("Description042") '中計1
desc024 = res("Response")("Data")(1)("DescriptionHash")("Description024") 'S_D.本体工事内上乗せ
desc026 = res("Response")("Data")(1)("DescriptionHash")("Description026") 'S_F.確定付帯工事
desc028 = res("Response")("Data")(1)("DescriptionHash")("Description028") 'S_H.サービス項目
desc029 = res("Response")("Data")(1)("DescriptionHash")("Description029") 'S_I.紹介料
desc030 = res("Response")("Data")(1)("DescriptionHash")("Description030") 'S_J.サービス項目 値引き
desc032 = res("Response")("Data")(1)("DescriptionHash")("Description032") 'S_L.その他工事
desc048 = res("Response")("Data")(1)("DescriptionHash")("Description048") '048.積算チェック
Set descAdata = JsonConverter.ParseJson(desc021)
Set descBdata = JsonConverter.ParseJson(desc022)
Set desc002data = JsonConverter.ParseJson(desc042)
Set descDdata = JsonConverter.ParseJson(desc024)
Set descFdata = JsonConverter.ParseJson(desc026)
Set descHdata = JsonConverter.ParseJson(desc028)
Set descIdata = JsonConverter.ParseJson(desc029)
Set descJdata = JsonConverter.ParseJson(desc030)
Set descLdata = JsonConverter.ParseJson(desc032)
Set desc008data = JsonConverter.ParseJson(desc048)
'設計契約粗利益確認書
Set arariSh = Worksheets("粗利益確認書(設計契約)")
arariSh.Cells(1, 18) = res("Response")("Data")(1)("ResultId")
'------------------------------------------------------------
'本体金額
xx = 11
For Each value In descAdata
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
Next value
'------------------------------------------------------------
'付帯工事
xx = 12
For Each value In descBdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
If xx = 22 Then
Exit For
End If
Next value
'------------------------------------------------------------
'中計1 利益率
xx = 24
For Each value In desc002data
arariSh.Cells(xx, 12) = value("7")
xx = xx + 1
Next value
'------------------------------------------------------------
'本体工事内上乗せ
xx = 25
For Each value In descDdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 35 Then
Exit For
End If
Next value
'------------------------------------------------------------
'確定付帯上乗せ
xx = 37
For Each value In descFdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 47 Then
Exit For
End If
Next value
'------------------------------------------------------------
'サービス項目
xx = 49
For Each value In descHdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 59 Then
Exit For
End If
Next value
'------------------------------------------------------------
'紹介料
xx = 59
For Each value In descIdata
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
Next value
'------------------------------------------------------------
'値引き
xx = 60
For Each value In descJdata
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
Next value
'------------------------------------------------------------
'その他項目
xx = 63
For Each value In descLdata
arariSh.Cells(xx, 3) = value("0")
arariSh.Cells(xx, 6) = value("1")
arariSh.Cells(xx, 7) = value("2")
arariSh.Cells(xx, 8) = value("3")
arariSh.Cells(xx, 9) = value("4")
xx = xx + 1
If xx = 73 Then
Exit For
End If
Next value
'------------------------------------------------------------
'積算チェック
xx = 80
For Each value In desc008data
arariSh.Cells(xx, 7) = value("2")
xx = xx + 1
Next value
'------------------------------------------------------------
'Debug.Print "<< 粗利益確認書 出力完了"
End Function

View File

@ -0,0 +1,242 @@
Attribute VB_Name = "Module7"
Option Explicit
'リードタイム、工期計算データインポート
Sub getOtherData()
Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
Call init
'Debug.Print ">>> 関連テーブルのダウンロード 開始"
Dim resultId As String
resultId = Range("ResultId").value
If resultId <> "" Then
'リードタイムデータ取得
'Debug.Print ">> リードタイムデータ取得開始"
Call getOtherTableData(resultId, "116503", "R")
'Debug.Print "<< リードタイムデータ取得完了"
'工期計算データ取得
'Debug.Print ">> 工期計算データ取得開始"
Call getOtherTableData(resultId, "203147", "K")
'Debug.Print "<< 工期計算データ取得完了"
'追加変更WFデータ取得
'Debug.Print ">> 追加変更WFデータ取得開始"
Call getOtherTableData(resultId, "212533", "T")
'Debug.Print "<< 追加変更WFデータ取得完了"
Call getArariDataRequest(resultId)
End If
Application.Calculation = xlAutomatic '自動計算開始
Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< 関連テーブルのダウンロード 終了"
End Sub
'MSSマスターシートのIDを指定して、関連テーブルから出たを取得する
Function getOtherTableData(classA, targetId, shName)
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'リードタイムテーブルID
tableId = targetId
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/items/" & tableId & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'Filter変数
Dim colFilter As New Dictionary
colFilter.Add "ClassA", "[" & classA & "]"
'View変数
Dim view As New Dictionary
view.Add "ColumnFilterHash", colFilter
apiBody.Add "View", view
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
'Debug.Print res("StatusCode")
'Debug.Print res("Response")("TotalCount")
If res("StatusCode") = 200 Then
'グローバル変数へ情報格納
'Debug.Print res("StatusCode")
'正常に取得できたらシートへ書き込み
'Debug.Print "<<< データ取得成功"
Call exportDataToSheet(res, shName)
End If
End Function
Function exportDataToSheet(res, shName)
'Debug.Print ">>> データ出力開始"
Dim sh As Worksheet
Set sh = Worksheets(shName)
'シートをクリア
sh.Cells.Clear
Dim data As New Dictionary
Dim value
Dim i, j As Long
i = 1
For Each value In res("Response")("Data")
data.Add "ResultId", value("ResultId")
data.Add "Status", value("Status")
data.Add "ItemTitle", value("ItemTitle")
data.Add "Updator", value("Updator")
data.Add "UpdatedTime", stringToDate(value("UpdatedTime"))
data.Add "Body", value("Body")
Dim keys, items, count
'Class
keys = value("ClassHash").keys
items = value("ClassHash").items
count = value("ClassHash").count
For j = 0 To count - 1
data.Add keys(j), items(j)
Next j
'Num
keys = value("NumHash").keys
items = value("NumHash").items
count = value("NumHash").count
For j = 0 To count - 1
data.Add keys(j), items(j)
Next j
'Date
keys = value("DateHash").keys
items = value("DateHash").items
count = value("DateHash").count
For j = 0 To count - 1
data.Add keys(j), stringToDate(items(j))
Next j
'Description
keys = value("DescriptionHash").keys
items = value("DescriptionHash").items
count = value("DescriptionHash").count
For j = 0 To count - 1
data.Add keys(j), items(j)
Next j
'Check
keys = value("CheckHash").keys
items = value("CheckHash").items
count = value("CheckHash").count
For j = 0 To count - 1
data.Add keys(j), items(j)
Next j
data.Add "Owner", value("Owner")
Dim k, itemCount As Long
itemCount = data.count
For k = 1 To itemCount
If (i) = 1 Then
sh.Cells((i), k) = data.keys(k - 1)
End If
sh.Cells((i + 1), k) = data.items(k - 1)
Next k
data.RemoveAll
i = i + 1
Next value
'Debug.Print "<<< データ出力完了"
End Function
'すべての追加変更WF申請データ未完了分を取得する
Sub getAllTsuihenList()
Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
Call init
'Debug.Print ">>> すべての追加変更WF申請データ未完了分を取得 開始"
Dim shName
shName = "T"
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'リードタイムテーブルID
tableId = "212533"
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/items/" & tableId & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'Filter変数
Dim colFilter As New Dictionary
colFilter.Add "Status", "[100,101,200]"
Dim colSorter As New Dictionary
colSorter.Add "Status", "desc"
'View変数
Dim view As New Dictionary
view.Add "ColumnFilterHash", colFilter
view.Add "ColumnSorterHash", colSorter
apiBody.Add "View", view
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
'Debug.Print res("StatusCode")
'Debug.Print res("Response")("TotalCount")
If res("StatusCode") = 200 Then
'グローバル変数へ情報格納
'Debug.Print res("StatusCode")
'正常に取得できたらシートへ書き込み
'Debug.Print "<<< データ取得成功"
Call exportDataToSheet(res, shName)
End If
Application.Calculation = xlAutomatic '自動計算開始
Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< すべての追加変更WF申請データ未完了分を取得 終了"
End Sub

View File

@ -0,0 +1,292 @@
Attribute VB_Name = "Module8"
Option Explicit
'リストから契約コードを選択する
Sub getTsuihenFiles()
'Application.ScreenUpdating = False '画面更新停止
Application.Calculation = xlManual '自動計算停止
Call init
'Debug.Print ">>> 選択した追加変更申請の関連データをダウンロードする"
Dim Ad As String 'セル番号用変数
Dim Col As Integer 'セルの列番号用変数
Dim Row As Integer 'セルの行番号用変数
Dim sh As Worksheet
Set sh = Worksheets(thList)
Ad = ActiveCell.Address
Col = ActiveCell.Column
Row = ActiveCell.Row
'テーブル範囲無いにカーソルがあるときにボタンを押したら、契約コードを取得する
If Row >= 3 And Row <= 104 And Col >= 4 And Col <= 19 Then
Dim recoreId As Variant
recoreId = sh.Cells(Row, 5).value
'Debug.Print recoreId
If recoreId <> 0 Then
Range("WF追変申請ID").value = recoreId
'リスト消去
With sh.Range("B11")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
With sh.Range("B14:B113")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
Call getTsuihenFilesRequest(recoreId)
Else
Range("WF追変申請ID").value = ""
'リスト消去
With sh.Range("B11")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
With sh.Range("B14:B113")
.ClearContents
.Hyperlinks.Delete
.Font.Color = RGB(0, 0, 0)
.Font.Underline = False
.Font.Bold = False
End With
MsgBox "取得したいレコードを選択してください"
End If
Else
Range("WF追変申請ID").value = ""
MsgBox "取得したいレコードを選択してください"
End If
Application.Calculation = xlAutomatic '自動計算開始
'Application.ScreenUpdating = True '画面更新開始
'Debug.Print "<<< 選択した追加変更申請の関連データをダウンロードを終了しました"
End Sub
Function getTsuihenFilesRequest(targetId)
'共通変数
Dim apiUrl As String
Dim apiUrlParam As String
Dim tableId As String
'リードタイムテーブルID
tableId = targetId
'リクエストURL
apiUrl = baseURL & "/pleasanter/api/items/" & tableId & "/"
apiUrlParam = "Get"
'ヘッダ
Dim apiHeaders As New Dictionary
apiHeaders.Add "Content-Type", "application/json;charset=utf-8"
'リクエストデータ
Dim apiBody As New Dictionary
apiBody.Add "ApiVersion", "1.1"
apiBody.Add "ApiKey", apiKey
'HTTPリクエスト送信メソッド呼び出し
Dim res As Object
Set res = callRestApi("POST", apiUrl, apiUrlParam, apiHeaders, apiBody)
'Debug.Print res("StatusCode")
'Debug.Print res("Response")("TotalCount")
If res("StatusCode") = 200 Then
'グローバル変数へ情報格納
'Debug.Print res("StatusCode")
'Debug.Print res("Response")("TotalCount")
'正常に取得できたらシートへ書き込み
'Debug.Print "<<< 追加変更データ取得成功"
Call exporTsuihenFiles(res)
End If
End Function
Function exporTsuihenFiles(res)
Dim sh As Worksheet
Set sh = Worksheets(thList)
Dim hyplink As Hyperlink
Dim tsuihenFolder As String
'追加変更データ保存フォルダ名
tsuihenFolder = res("Response")("Data")(1)("ClassHash")("ClassM")
'Debug.Print currentDirPath & "\" & tsuihenFolder
'顧客別フォルダが存在するか確認
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
'追加変更保存フォルダ
If Not fso.FolderExists(currentDirPath & "\" & tsuihenFolder) Then
'ない場合はフォルダを作成
fso.CreateFolder (currentDirPath & "\" & tsuihenFolder)
End If
Dim file
Dim saveFolderPath As String
Dim guid As String
Dim name As String
Dim result As Boolean
Dim xx As Long
xx = 14
sh.Cells(xx, 2).value = "---ダウンロード開始---"
xx = xx + 1
sh.Cells(11, 2).value = tsuihenFolder
Set hyplink = sh.Hyperlinks.Add( _
Anchor:=sh.Cells(11, 2), _
Address:=tsuihenFolder)
For Each file In res("Response")("Data")(1)("AttachmentsHash")("AttachmentsA")
saveFolderPath = currentDirPath & "\" & tsuihenFolder & "\" & "契約書原本"
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
guid = file("Guid")
name = file("Name")
'ダウンロード処理
result = getAttachmentsFile(guid, saveFolderPath)
'ダウンロード履歴保存
If result = True Then
sh.Cells(xx, 2).value = "契約書原本" & "\" & name
Set hyplink = sh.Hyperlinks.Add( _
Anchor:=sh.Cells(xx, 2), _
Address:=tsuihenFolder & "\" & "契約書原本" & "\" & name)
xx = xx + 1
End If
Next file
For Each file In res("Response")("Data")(1)("AttachmentsHash")("AttachmentsB")
saveFolderPath = currentDirPath & "\" & tsuihenFolder & "\" & "金額根拠資料①"
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
guid = file("Guid")
name = file("Name")
'ダウンロード処理
result = getAttachmentsFile(guid, saveFolderPath)
'ダウンロード履歴保存
If result = True Then
sh.Cells(xx, 2).value = "金額根拠資料①" & "\" & name
Set hyplink = sh.Hyperlinks.Add( _
Anchor:=sh.Cells(xx, 2), _
Address:=tsuihenFolder & "\" & "金額根拠資料①" & "\" & name)
xx = xx + 1
End If
Next file
For Each file In res("Response")("Data")(1)("AttachmentsHash")("AttachmentsC")
saveFolderPath = currentDirPath & "\" & tsuihenFolder & "\" & "金額根拠資料②"
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
guid = file("Guid")
name = file("Name")
'ダウンロード処理
result = getAttachmentsFile(guid, saveFolderPath)
'ダウンロード履歴保存
If result = True Then
sh.Cells(xx, 2).value = "金額根拠資料②" & "\" & name
Set hyplink = sh.Hyperlinks.Add( _
Anchor:=sh.Cells(xx, 2), _
Address:=tsuihenFolder & "\" & "金額根拠資料②" & "\" & name)
xx = xx + 1
End If
Next file
For Each file In res("Response")("Data")(1)("AttachmentsHash")("AttachmentsD")
saveFolderPath = currentDirPath & "\" & tsuihenFolder & "\" & "金額根拠資料③"
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
guid = file("Guid")
name = file("Name")
'ダウンロード処理
result = getAttachmentsFile(guid, saveFolderPath)
If result = True Then
sh.Cells(xx, 2).value = "金額根拠資料③" & "\" & name
Set hyplink = sh.Hyperlinks.Add( _
Anchor:=sh.Cells(xx, 2), _
Address:=tsuihenFolder & "\" & "金額根拠資料③" & "\" & name)
xx = xx + 1
End If
Next file
For Each file In res("Response")("Data")(1)("AttachmentsHash")("AttachmentsE")
saveFolderPath = currentDirPath & "\" & tsuihenFolder & "\" & "金額根拠資料④"
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
guid = file("Guid")
name = file("Name")
'ダウンロード処理
result = getAttachmentsFile(guid, saveFolderPath)
If result = True Then
sh.Cells(xx, 2).value = "金額根拠資料④" & "\" & name
Set hyplink = sh.Hyperlinks.Add( _
Anchor:=sh.Cells(xx, 2), _
Address:=tsuihenFolder & "\" & "金額根拠資料④" & "\" & name)
xx = xx + 1
End If
Next file
For Each file In res("Response")("Data")(1)("AttachmentsHash")("AttachmentsF")
saveFolderPath = currentDirPath & "\" & tsuihenFolder & "\" & "金額根拠資料⑤"
If Not fso.FolderExists(saveFolderPath) Then
'ない場合はフォルダを作成
fso.CreateFolder (saveFolderPath)
End If
guid = file("Guid")
name = file("Name")
'ダウンロード処理
result = getAttachmentsFile(guid, saveFolderPath)
If result = True Then
sh.Cells(xx, 2).value = "金額根拠資料⑤" & "\" & name
Set hyplink = sh.Hyperlinks.Add( _
Anchor:=sh.Cells(xx, 2), _
Address:=tsuihenFolder & "\" & "金額根拠資料⑤" & "\" & name)
xx = xx + 1
End If
Next file
sh.Cells(xx, 2).value = "---ダウンロード終了---"
End Function

View File

@ -0,0 +1,13 @@
# Changelog
## Xdebug (Under Construction)
- This package provides a way to simulate VBA Immediate Window in Output VSCode window
## [1.0.0b0] - 2020-09-16
### Added
- Create XDebug.printx
- Create XDebug.printError

View File

@ -0,0 +1,58 @@
# Xdebug (VBA Immediate Window in Output VSCode Window)
## Description
- This package provides a way to simulate VBA Immediate Window in Output VSCode window
- Find the Output window (VBA Immediate Window)
## Methods
<p>
<img src="https://github.com/Aeraphe/xdebug/blob/main/images/immediate.gif" alt="VBA immediate Window">
</p>
### Xdebug.printx
- This method print any type os variable
```
Public Sub index()
Dim test(1) As Variant
'Add an Object
Set test(0) = Sheets(1)
'Add a String
test(1) = "Test Xdebug Output"
Xdebug.printx test
End Sub
```
### Xdebug.printError
- This method is use for print error
```
Public Sub index()
On Error GoTo ErrorHandle:
'throw an error
d = 1/0
'Your code here
ErrorHandle:
Xdebug.errorSource = "pageConsoller.index"
Xdebug.printError
End Sub
```

View File

@ -0,0 +1,241 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Xdebug"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'namespace=xvba_modules\Xdebug
Public env As String
'Example of Package Create by XVBA-CLI
Private OS_TMP__FOLDER_PATH As String
Private IMMEDIATE_FOLDER As String
Private IMMEDIATE_FILE As String
Private DEBUG_FILE_PATH As String
Const EMPTY_TYPE = 0
Const NULL_TYPE = 1
Const ERROR_TYPE = 10
Const INTEGER_TYPE = 2
Const LONG_TYPE = 3
Const SINGLE_TYPE = 4
Const DOUBLE_TYPE = 5
Const CURRENCY_TYPE = 6
Const DATE_TYPE = 7
Const DECIMAL_TYPE = 14
Const LONG_LONG_TYPE = 20
Const BOOLEAN_TYPE = 11
Const STRING_TYPE = 8
Const ARRAY_TYPE = 8204
Const OBJECT_TYPE = 9
Const VARIANT_TYPE = 12
Const DATA_OBJECT_TYPE = 13
Private Const MESSAGE_SPACE = " "
Public errorSource As String
Public errorTitle As String
'/*
'Flag for Actrive os Deactive VBA Debug.Print
'*/
Public vbaDebugPrintActive As Boolean
Private Sub class_initialize()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
OS_TMP__FOLDER_PATH = fso.GetSpecialFolder(2)
IMMEDIATE_FOLDER = "xvba_immediate"
IMMEDIATE_FILE = "immediate.txt"
vbaDebugPrintActive = True
errorSource = ""
errorTitle = "XVBA: New Error Was Found"
env = "DEV"
DEBUG_FILE_PATH = OS_TMP__FOLDER_PATH & "\" & IMMEDIATE_FOLDER & "\" & IMMEDIATE_FILE
End Sub
Public Function printx(inputValue As Variant, Optional messageType As Integer = 1)
If (env = "DEV") Then
Dim messageText As String
messageText = createOutputMessage(inputValue)
Call writeDebugFileContent(messageText, messageType)
End If
End Function
'/*
'Print A Error
'
'*/
Public Function printError()
If (env = "DEV") Then
Dim message As String
message = ErrorHanddler()
Call writeDebugFileContent(message, 0)
End If
End Function
'/*
'
'Write Debug ino on File
'
'
'*/
Private Function writeDebugFileContent(messageText, messageType)
Dim filePath As String
Dim FileNum As Integer
Dim PREFIX As String
filePath = DEBUG_FILE_PATH
FileNum = FreeFile
PREFIX = Now & " - "
Open filePath For Append As #FileNum
Dim debugMessage As String
Select Case messageType
Case 0 'Error Message
debugMessage = PREFIX & "Error:" & messageText
Case 1 'Success
debugMessage = PREFIX & messageText
Case Else 'No Type Set
debugMessage = PREFIX & "Info:" & messageText
End Select
Print #FileNum, debugMessage
Close #FileNum
If (vbaDebugPrintActive) Then
Debug.Print debugMessage
End If
End Function
Private Function createOutputMessage(inputValue) As String
Dim typeOfVar As Integer
Dim response As String
typeOfVar = VarType(inputValue)
'Set Error Source Macro/Function name
Err.Source = "createOutputMessage"
Select Case typeOfVar
Case STRING_TYPE
response = "String: " & inputValue
Case INTEGER_TYPE
response = "Integer: " & CStr(inputValue)
Case LONG_TYPE
response = "Long: " & CStr(inputValue)
Case SINGLE_TYPE
response = "Single: " & CStr(inputValue)
Case DOUBLE_TYPE
response = "Double: " & CStr(inputValue)
Case CURRENCY_TYPE
response = "Currenty: " & CStr(inputValue)
Case DATE_TYPE
response = "Date: " & CStr(inputValue)
Case DECIMAL_TYPE
response = "Decimal: " & CStr(inputValue)
Case LONG_LONG_TYPE
response = "LongLong: " & CStr(inputValue)
Case BOOLEAN_TYPE
response = "Boolean: " & CStr(inputValue)
Case ARRAY_TYPE
response = makeArrayTypeMessage(inputValue)
Case EMPTY_TYPE
response = "Empty: "
Case OBJECT_TYPE
response = "Object: " & TypeName(inputValue)
Case NULL_TYPE
response = "Null: "
Case ERROR_TYPE
response = "Error: "
Case VARIANT_TYPE
response = "Variant: "
Case DATA_OBJECT_TYPE
response = "Data Object: " & TypeName(inputValue)
Case Else
response = "Type Not Supported yet please inform xvba developer "
Debug.Print typeOfVar
Debug.Print inputValue
End Select
createOutputMessage = response
End Function
Private Function makeArrayTypeMessage(inputValue) As String
Dim nextItem As Variant
Dim response As String
Dim message As String
For Each nextItem In inputValue
message = createOutputMessage(nextItem)
response = response & " [ " & message & " ]" & vbCrLf
Next nextItem
makeArrayTypeMessage = "Array: " & vbCrLf & response
End Function
Private Function ErrorHanddler() As String
Dim errorDescription As String
Dim numberDescription As String
Dim lineError As String
Dim sourceError As String
Dim errorTitleMsg As String
Dim errorSourceMsg As String
errorTitleMsg = vbCrLf & MESSAGE_SPACE & errorTitle
errorSourceMsg = vbCrLf & MESSAGE_SPACE & "Error Source: " & errorSource
Select Case Err.Number
Case 11
numberDescription = vbCrLf & MESSAGE_SPACE & "Error Number: " & Err.Number
lineError = vbCrLf & MESSAGE_SPACE & "Error Line: " & Erl
errorDescription = vbCrLf & MESSAGE_SPACE & "Error Description: " & Err.Description
Case Else
numberDescription = vbCrLf & MESSAGE_SPACE & "Error Number: " & Err.Number
errorDescription = vbCrLf & MESSAGE_SPACE & "Error Description: " & Err.Description
End Select
ErrorHanddler = errorTitleMsg & lineError & errorSourceMsg & numberDescription & errorDescription
End Function

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,15 @@
{
"package": "Xdebug",
"version": "1.0.0",
"author": "Alberto Edaurdo",
"email": "alberto.aeraphe@gmail.com",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/Aeraphe/xdebug.git"
},
"description": "Creating amazing XVBA packages",
"dependencies": {},
"dev_dependencies": {},
"homepage": "www.xvba.dev"
}

View File

@ -0,0 +1,8 @@
# Changelog
## excel@types (Under Construction)
- This package provides a way to use auto-complete for excel class

View File

@ -0,0 +1,51 @@
# Excel VBA type Definitions Package (excel-types)
- This package provides a way to use auto-complete for Excel VBA Class
- You can Create your own vba type definition packages our update this.
- Type definition packages are named like: name-types
- The packages are store in www.xvba.dev
- Ech excel vba class has your own file definition
- The files extension has to be filename.d.vb
- Auto-complete just expose Public types
## Create,install and share VBA Packages With Xvba-cli and Xvba Repository:
- Xvba Repository : <a href="https://www.xvba.dev"> www.xvba.dev</a>
- XVBA-CLI Command Line Interface for XVBA VSCode extension <a href="https://www.npmjs.com/package/@localsmart/xvba-cli">@localsmart/xvba-cli </a>
## Install
- For instal excel-types just use XVBA-CLI install command
```
npx xvba install excel-types
```
## Comments Block
- Use comments blocks below for documenting class/methods/Subs/Functions/Properties
- The comments blocs has to start with '/* and ends with '*/
```
'/*
'Represents the entire Microsoft Excel application.
'
'
'*/
Public Class Application()
```
```
'/*
'Returns a Range object that represents the active cell in the active window
'(the window on top) or in the specified window. If the window isn't displaying
'a worksheet, this property fails. Read-only.
'
'@type {Object.<Range>}
'
'*/
Public Property ActiveCell As Range
```

View File

@ -0,0 +1,147 @@
'/*
'Represents the entire Microsoft Excel application.
'
'
'*/
Public Class Application()
'/*
'Returns an object that represents the active sheet (the sheet on top)
'in the active workbook or in the specified window or workbook.
'Returns Nothing if no sheet is active.
'
'*/
Public Property ActiveSheet As Worksheet
'/*
'Returns a Workbook object that represents the workbook in the
'active window (the window on top).
'Returns Nothing if there are no windows open or if either
'the Info window or the Clipboard window is the active window. Read-only.
'
'
'*/
Public Property ActiveWorkbook As Workbook
'/*
'True if Microsoft Excel displays certain alerts and messages while
'a macro is running. Read/write Boolean.
'
'Example
'Application.DisplayAlerts = False
'Workbooks("BOOK1.XLS").Close
'Application.DisplayAlerts = True
'
'*/
Public Property DisplayAlerts As Boolean
'/*
'Returns or sets an XlCalculation value that represents the calculation mode.
'
'Example
'Application.Calculation = xlCalculationManual
'Application.Calculation = xlAutomatic
'
'@type {XlCalculation}
'*/
Public Property Calculation As XlCalculation
'/*
'True if events are enabled for the specified object. Read/write Boolean.
'
'@type {Boolean}
'*/
Public Property EnableEvents As Boolean
'/*
'True if screen updating is turned on. Read/write Boolean.
'@type {Boolean}
'*/
Public Property ScreenUpdating As Boolean
'/*
'Returns a Range object that represents the active cell in the active window
'(the window on top) or in the specified window. If the window isn't displaying
'a worksheet, this property fails. Read-only.
'
'@type {Object.<Range>}
'
'*/
Public Property ActiveCell As Range
'/*
'Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet).
'An embedded chart is considered active when it's either selected or activated. When no chart is active,
'this property returns Nothing.
'
'Example:
'ActiveChart.HasLegend = True
'
'@type {Object.<Chart>}
'*/
Public Property ActiveChart As Chart
'/*
'Returns a Workbooks collection that represents all the open workbooks. Read-only.
'
'@type {Object.<Collection>} Workbooks Collection
'*/
Public Property ThisWorkbook As Workbook
'/*
'Returns a Workbooks collection that represents all the open workbooks. Read-only.
'
'@type {Object.<Collection>} Workbooks Collection
'*/
Public Property Workbooks As Workbooks
'/*
'Activates a Microsoft application. If the application is already running,
'this method activates the running application.
'If the application isn't running, this method starts a new instance of the application.
'
'Example: (This example starts and activates Word.)
'
'Application.ActivateMicrosoftApp xlMicrosoftWord
'
'@param {XlMSApplication} index
'*/
Public Sub ActivateMicrosoftApp( index As XlMSApplication)
End Sub
'/*
'An event occurs when all pending refresh activity (both synchronous and asynchronous)
'and all of the resultant calculation activities have been completed.
'
'*/
Public Event AfterCalculate()
'/*
'Occurs when a new workbook is created.
'
'Example:
'
'Private Sub App_NewWorkbook(ByVal Wb As Workbook)
'Application.Windows.Arrange xlArrangeStyleTiled End Sub
'
'@param {Workbook} Wb
'*/
Public Event NewWorkbook(ByVal Wb As Workbook)
'/*
'Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
'
'Example:
'Set newSheet = Sheets.Add(Type:=xlWorksheet)
'For i = 1 To Sheets.Count
' newSheet.Cells(i, 1).Value = Sheets(i).Name
' Next i
'
'@type {Sheets}
'*/
Public Property Sheets As Worksheets
End Class

View File

@ -0,0 +1,109 @@
'/*
'
'
'
'/*
Public Class Scripting()
'/*
'
'Object that stores data key/item pairs.
'
'/*
Public Function Dictionary()
End Function
'/*
'
'Adds a new key/item pair to a Dictionary object.
'
'*/
Public Sub Add()
End Sub
'/*
'
'Returns a Boolean value that indicates whether a specified key exists in the Dictionary object.
'
'*/
Public Sub Exists()
End Sub
'/*
'
'Returns an array of all the items in a Dictionary object.
'
'*/
Public Sub Items()
End Sub
'/*
'
'Returns an array of all the keys in a Dictionary object.
'
'*/
Public Sub Keys()
End Sub
'/*
'
'Removes one specified key/item pair from the Dictionary object.
'
'*/
Public Sub Remove()
End Sub
'/*
'
'Removes all the key/item pairs in the Dictionary object.
'
'*/
Public Sub RemoveAll()
End Sub
'/*
'Sets or returns the comparison mode for comparing keys in a Dictionary object.
'
'
'*/
Public Property CompareMode As Variant
'/*
'Returns the number of key/item pairs in a Dictionary object.
'
'
'*/
Public Property Count As Long
'/*
'Sets or returns the value of an item in a Dictionary object.
'
'
'*/
Public Property Item As Variant
'/*
'Sets a new key value for an existing key value in a Dictionary object.
'
'
'*/
Public Property Key As Variant
End Class

View File

@ -0,0 +1,30 @@
'/*
'Contains information about run-time errors.
'
'
'*/
Public Class Err()
'/*
'Returns or sets a string expression containing a
'descriptive string associated with an object. Read/write.
'
'*/
Public Property Description As String
'/*
'Returns or sets a numeric value specifying an error.
'Number is the Err object's default property. Read/write.
'
'*/
Public Property Number As Integer
'/*
'Returns or sets a string expression specifying the name of
'the object or application that originally generated the error. Read/write.
'
'*/
Public Property Source As String
End Class

View File

@ -0,0 +1,547 @@
'/*
'[Conversion Func]
'
'*/
Function Asc()
End Function
'/*
'[Conversion Func]
'Returns a String containing the character associated
'with the specified character code.
'
'Example:
'
'Dim MyChar
'MyChar = Chr(65) ' Returns A.
'MyChar = Chr(97) ' Returns a.
'MyChar = Chr(62) ' Returns >.
'MyChar = Chr(37) ' Returns %.
'*/
Function Chr()
End Function
'/*
'[Conversion Func]
'
'*/
Function Format()
End Function
'/*
'[Conversion Func]
'
'*/
Function Hex()
End Function
'/*
'[Conversion Func]
'
'*/
Function Oct()
End Function
'/*
'[Conversion Func]
'Returns a Variant (String) representation of a number.
'
'Example:
'Dim MyString
'MyString = Str(459) ' Returns " 459".
'MyString = Str(-459.65) ' Returns "-459.65".
'MyString = Str(459.001) ' Returns " 459.001".
'
'*/
Function Str() As Variant
End Function
'/*
'[Conversion Func]
'Returns the numbers contained in a string as
'a numeric value of appropriate type.
'
'Example:
'
'Dim MyValue
'MyValue = Val("2457") ' Returns 2457.
'MyValue = Val(" 2 45 7") ' Returns 2457.
'MyValue = Val("24 and 57") ' Returns 24.
'*/
Function Val(String)
End Function
Function CreateObject()
End Function
Function CurDir()
End Function
'/*
'Returns a Variant (Date) containing the current system date.
'
'Example
'
'Dim MyDate
'MyDate = Date ' MyDate contains the current system date.
'
'*/
Function Date()
End Function
Function DateDiff()
End Function
Function DatePart()
End Function
Function DateSerial()
End Function
Function Day()
End Function
Function DDB()
End Function
Function Dir()
End Function
Function DoEvents()
End Function
Function Environ()
End Function
Function EOF()
End Function
Function Error()
End Function
Function FileAttr()
End Function
Function FileDateTime()
End Function
Function FileLen()
End Function
Function Filter()
End Function
Function FormatCurrency()
End Function
Function FormatDateTime()
End Function
Function FormatNumber()
End Function
Function FormaPercent()
End Function
Function FreeFile()
End Function
Function FV()
End Function
Function GetAllSettings()
End Function
Function GetAttr()
End Function
Function GetObject()
End Function
Function GetSetting()
End Function
Function Hour()
End Function
Function IIf()
End Function
Function IMEStatus()
End Function
Function Input()
End Function
Function InputBox()
End Function
Function InStr()
End Function
Function InStrRev()
End Function
Function IPmt()
End Function
Function IRR()
End Function
Function IsArray()
End Function
Function IsDate()
End Function
'/*
'
'Returns a Boolean value indicating whether a variable has been initialized.
'
'*/
Function IsEmpty()
End Function
Function IsError()
End Function
Function IsMissing()
End Function
Function IsNull()
End Function
Function IsNumeric()
End Function
Function IsObject()
End Function
'/*
'Returns a string created by joining a number of substrings contained in an array.
'
'*/
Function Join()
End Function
Function LBound()
End Function
Function LCase()
End Function
Function Left()
End Function
Function Len()
End Function
Function Loc()
End Function
Function LOF()
End Function
Function LTrim()
End Function
Function RTrim()
End Function
Function Trim()
End Function
Function MacID()
End Function
Function MacScript()
End Function
'/*
'[Math Function]
'Returns a value of the same type that is passed to it specifying the absolute value of a number.
'
'*/
Function Abs()
End Function
'/*
'[Math Function]
'Returns a Double specifying the arctangent of a number.
'
'*/
Function Atn()
End Function
'/*
'[Math Function]
'
'*/
Function Cos()
End Function
'/*
'[Math Function]
'
'*/
Function Exp()
End Function
'/*
'[Math Function]
'
'*/
Function Int()
End Function
'/*
'[Math Function]
'
'*/
Function Fix()
End Function
'/*
'[Math Function]
'
'*/
Function Log()
End Function
'/*
'[Math Function]
'
'*/
Function Rnd()
End Function
'/*
'[Math Function]
'
'*/
Function Sgn()
End Function
'/*
'[Math Function]
'
'*/
Function Sin()
End Function
'/*
'[Math Function]
'
'*/
Function Sqr()
End Function
'/*
'[Math Function]
'
'*/
Function Tan()
End Function
Function Mid()
End Function
Function Minute()
End Function
Function MIRR()
End Function
Function Month()
End Function
Function MonthName()
End Function
'/*
'Displays a message in a dialog box, waits for the user to click a button,
'and returns an Integer indicating which button the user clicked.
'
'*/
Function MsgBox(prompt, [ buttons, ] [ title, ] [ helpfile, context ])
End Function
Function Now()
End Function
Function NPer()
End Function
Function NPV()
End Function
Function PPmt()
End Function
Function QBColor()
End Function
Function Rate()
End Function
'/*
'Returns a string, which is a substring of a string
'expression beginning at the start position (defaults to 1),
'in which a specified substring has been replaced with another
'substring a specified number of times.
'
'*/
Function Replace(expression, find, replace, [ start, [ count, [ compare ]]])
End Function
Function RGB()
End Function
Function Right()
End Function
Function Round()
End Function
Function Second()
End Function
Function Seek()
End Function
Function Shell()
End Function
Function SNL()
End Function
Function Space()
End Function
Function Spc()
End Function
Function Split()
End Function
Function StrComp()
End Function
Function StrConv()
End Function
Function String()
End Function
Function StrReverse()
End Function
Function Switch()
End Function
Function SYD()
End Function
Function Tab()
End Function
Function Time()
End Function
Function Timer()
End Function
Function TimeSerial()
End Function
Function TimeValue()
End Function
Function TypeName()
End Function
Function UBound()
End Function
Function Ucase()
End Function
Function VarType()
End Function
Function Weekday()
End Function
Function WeekdayName()
End Function
Function Year()
End Function

View File

@ -0,0 +1,625 @@
'/*
'Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.
'
'
'*/
Public Class Range()
'/*
'(Range)
'
'Activates a single cell, which must be inside the current selection.
'To select a range of cells, use the Select method.,
'
'Example
'
'This example selects cells A1:C3 on Sheet1 and then makes cell B2 the active cell.
'
' Worksheets("Sheet1").Activate
' Range("A1:C3").Select
' Range("B2").Activate
'
'*/
Public Sub Activate()
End Sub
'/*
'Adds a comment to the range.
'
'Example:
'
'Worksheets(1).Range("E5").AddComment "Current Sales"
'
'@param {String} text
'*/
Public Sub AddComment(text As String)
End Sub
Public Sub AddCommentThreaded()
End Sub
Public Sub AdvancedFilter()
End Sub
Public Sub AllocateChanges()
End Sub
Public Sub ApplyName()
End Sub
Public Sub ApplyOutLineStyles()
End Sub
Public Sub AutoComplete()
End Sub
Public Sub AutoFill()
End Sub
Public Sub AutoFilter()
End Sub
Public Sub AutioFit()
End Sub
Public Sub AutoOutline()
End Sub
Public Sub BorderAround()
End Sub
Public Sub Calculate()
End Sub
Public Sub CalculateRowMajorOrder()
End Sub
Public Sub CheckSpelling()
End Sub
Public Sub Clear()
End Sub
Public Sub ClearComments()
End Sub
Public Sub ClearContents()
End Sub
Public Sub ClearFormats()
End Sub
Public Sub ClearHyperlinks()
End Sub
Public Sub ClearNotes()
End Sub
Public Sub ClearOutline()
End Sub
Public Sub ColumnDifferences()
End Sub
Public Sub Consolidate()
End Sub
Public Sub ConvertToLinkedDataType()
End Sub
Public Sub Copy()
End Sub
Public Sub CopyFromRecordset()
End Sub
Public Sub CopyPicture()
End Sub
Public Sub CreateNames()
End Sub
Public Sub Cut()
End Sub
Public Function DataSeries (Rowcol, Type, Date, Step, Stop, Trend)
End Function
Public Function DataTypeToText()
End Function
Public Function Delete (Shift)
End Function
Public Function DialogBox()
End Function
Public Function Dirty()
End Function
Public Function DiscardChanges()
End Function
Public Function EditionOptions (Type, Option, Name, Reference, Appearance, ChartSize, Format)
End Function
Public Function ExportAsFixedFormat (Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)
End Function
Public Function FillDown()
End Function
Public Function FillLeft()
End Function
Public Function FillRight()
End Function
Public Function FillUp()
End Function
Public Function Find (What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
End Function
Public Function FindNext (After)
End Function
Public Function FindPrevious (Before)
End Function
Public Function FlashFill ()
End Function
Public Function FunctionWizard ()
End Function
Public Function Group (Start, End, By, Periods)
End Function
Public Function Insert (Shift, CopyOrigin)
End Function
Public Function InsertIndent (InsertAmount)
End Function
Public Function Justify()
End Function
Public Function ListNames()
End Function
Public Function Merge(Across)
End Function
Public Function NavigateArrow(TowardPrecedent, ArrowNumber, LinkNumber)
End Function
Public Function NoteText(Text, Start, Length)
End Function
Public Function Parse(ParseLine, Destination)
End Function
Public Function PasteSpecial(Paste, Operation, SkipBlanks, Transpose)
End Function
Public Function PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName)
End Function
Public Function PrintPreview(EnableChanges)
End Function
Public Function RemoveDuplicates(Columns , Header)
End Function
Public Function RemoveSubtotal()
End Function
Public Function Replace(What, Replacement, LookAt, SearchOrder, MatchCase, MatchByte, SearchFormat, ReplaceFormat)
End Function
Public Function RowDifferences(Comparison)
End Function
Public Function Run(Arg1, Arg2, Arg3, Arg4, Arg5...)
End Function
Public Function Select()
End Function
Public Function SetCellDataTypeFromCell(Range, LanguageCulture)
End Function
Public Function SetPhonetic()
End Function
Public Function Show()
End Function
Public Function ShowCard()
End Function
Public Function ShowDependents(Remove)
End Function
Public Function ShowErrors()
End Function
Public Function ShowPrecedents(Remove)
End Function
Public Function Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2, DataOption3)
End Function
Public Function SortSpecial(SortMethod, Key1, Order1, Type, Key2, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, DataOption1, DataOption2, DataOption3)
End Function
Public Function Speak(SpeakDirection, SpeakFormulas)
End Function
Public Function SpecialCells(Type, Value)
End Function
Public Function SubscribeTo(Edition, Format)
End Function
Public Function Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks, SummaryBelowData)
End Function
Public Function Table(RowInput, ColumnInput)
End Function
Public Function TextToColumns(Destination, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers
End Function
Public Function Ungroup()
End Function
Public Function UnMerge()
End Function
Public Property AddIndent As Variant
Public Function Address(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo) As Variant
End Function
Public Function AddressLocal(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo) As Range
End Function
Public Property Application As Application
Public Property Areas As Areas
Public Property Borders As Variant
Public Property Cells As Range
Public Function Characters(Start, Length) As Variant
End Function
Public Property Column As Long
Public Property Columns As Long
Public Property ColumnWidth As Variant
Public Property Comment As Variant
Public Property CommentThreaded As Variant
Public Property Count As Long
Public Property CountLarge As Variant
Public Property Creator As Integer
Public Property CurrentArray As Range
'/*
'Returns a Range object that represents the current region.
'The current region is a range bounded by any combination of blank rows and blank columns. Read-only.
'
'Example
'Worksheets("Sheet1").Activate
'ActiveCell.CurrentRegion.Select
'*/
Public Property CurrentRegion As Range
Public Property Dependents As Range
Public Property DirectDependents As Range
Public Property DirectPrecedents As Range
Public Property DisplayFormat As Object
Public Function End(Direction) As Object
End Function
Public Property EntireColumn As Range
Public Property EntireRow As Range
Public Property Errors As Errors
Public Property Font As Font
Public Property FormatConditions As Range
Public Property Formula As Variant
Public Property FormulaArray As Variant
Public Property FormulaHidden As Variant
Public Property FormulaLocal As Object
Public Property FormulaR1C1 As Varaint
Public Property FormulaR1C1Local As Varaint
Public Property HasArray As Varaint
Public Property HasFormula As Varaint
Public Property HasRichDataType As Varaint
Public Property Height As Double
Public Property Hidden As Variant
Public Property HorizontalAlignment As Variant
Public Property Hyperlinks As Object
Public Property ID As String
Public Property IndentLevel As Variant
Public Property Interior As Double
Public Function Item (RowIndex, ColumnIndex) As Range
End Function
Public Property Left As Variant
Public Property LinkedDataTypeState As Variant
Public Property ListHeaderRows As Variant
Public Property ListObject As Object
Public Property LocationInTable As Variant
Public Property Locked As Variant
Public Property MDX As String
Public Property MergeArea As Range
Public Property MergeCells As Boolean
Public Property Name As Variant
Public Property Next As Range
Public Property NumberFormat As Variant
Public Property NumberFormatLocal As Variant
Public Function Offset (RowOffset, ColumnOffset) As Range
End Function
Public Property Orientation As Variant
Public Property OutlineLevel As Variant
Public Property PageBreak As Variant
Public Property Parent As Variant
Public Property Phonetic As Variant
Public Property Phonetics As Variant
Public Property PivotCell As Variant
Public Property PivotField As Variant
Public Property PivotItem As Variant
Public Property PivotTable As Variant
Public Property Precedents As Range
Public Property PrefixCharacter As Variant
Public Property Previous As Range
Public Property QueryTable As Variant
Public Function Range (Cell1, Cell2) As Range
End Function
Public Property ReadingOrder As Variant
Public Function Resize (RowSize, ColumnSize) As Range
End Function
Public Property Row As Long
Public Property RowHeight As Double
Public Property Rows As Range
Public Property ServerActions As Variant
Public Property ShowDetail As Variant
Public Property ShrinkToFit As Variant
Public Property SoundNote As Variant
Public Property SparklineGroups As Variant
Public Property Style As Variant
Public Property Summary As Variant
Public Property Text As String
Public Property Top As Variant
Public Property UseStandardHeight As Variant
Public Property UseStandardWidth As Variant
Public Property Validation As Variant
Public Function Value (RangeValueDataType) As Variant
End Function
Public Property Value2 As Variant
Public Property VerticalAlignment As Variant
Public Property Width As Double
Public Property Worksheet As Worksheet
Public Property WrapText As Variant
Public Property XPath As XPath
End Class

View File

@ -0,0 +1,157 @@
'/*
'Represents a Microsoft Excel workbook.
'
'
'*/
Public Class Workbook()
'/*
'Returns a String that represents the complete path to the
'workbook/file that this workbook object represents.
'
'*/
Public Property Path As String
Public Property Worksheets As Worksheet
'/*
'True if a backup file is created when this file is saved. Read-only Boolean.
'
'@type {Boolean}
'*/
Public Property CreateBackup As Boolean
'/*
'Returns a String value that represents the name of the object.
'
'@type {Boolean}
'*/
Public Property Name As String
'/*
'True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean.
'
'Example:
'If Not ActiveWorkbook.Saved Then
' MsgBox "This workbook contains unsaved changes."
'End If
'
'@type {Boolean}
'*/
Public Property Saved As String
'/*
'Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
'
'Example:
'Set newSheet = Sheets.Add(Type:=xlWorksheet)
'For i = 1 To Sheets.Count
' newSheet.Cells(i, 1).Value = Sheets(i).Name
' Next i
'
'@type {Sheets}
'*/
Public Property Sheets As Worksheets
'/*
'
'Activates the first window associated with the workbook.
'
'*/
Public Function Activate()
End Function
'/*
'
'Closes the object.
'
'Example
'
'Workbooks("BOOK1.XLS").Close SaveChanges:=False
'
'@param {Variant} SaveChanges:[Optional] True or false
'@param {Variant} FileName:[Optional] Saves changes under this file name.
'@param {Variant} RouteWorkbook:[Optional] True or False
'*/
Public Function Close(SaveChanges,FileName,RouteWorkbook)
End Function
'/*
'Saves changes to the specified workbook.
'*/
Public Function Save()
End Function
'/*
'Saves changes to the workbook in a different file.
'
'@param {Variant} FileName:[Optional]
'@param {Variant} FileFormat:[Optional]
'@param {Variant} Password:[Optional]
'@param {Variant} WriteResPassword:[Optional]
'@param {Variant} ReadOnlyRecommended:[Optional]
'@param {Variant} CreateBackup:[Optional]
'@param {Variant} AccessMode:[Optional]
'@param {Variant} ConflictResolution:[Optional]
'@param {Variant} AddToMru:[Optional]
'@param {Variant} TextCodepage:[Optional]
'@param {Variant} TextVisualLayout:[Optional]
'@param {Variant} Local:[Optional]
'*/
Public Function SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)
End Function
'/*
'Exports the data that has been mapped to the specified XML schema map to an XML data file.
'
'@param {String} FileName:[Required]
'@param {XmlMap} Map:[Required]
'*/
Public Function SaveAsXMLData(FileName, Map)
End Function
'/*
'Saves a copy of the workbook to a file but doesn't modify the open workbook in memory.
'
'Example
'ActiveWorkbook.SaveCopyAs "C:\TEMP\XXXX.XLS"
'
'@param {Variant} FileName:[Required]
'*/
Public Function SaveCopyAs(FileName, Map)
End Function
'/*
'Sends the workbook by using the installed mail system.
'
'Example
'ActiveWorkbook.SendMail recipients:="Jean Selva"
'
'@param {Variant} Recipients:[Required]
'@param {Variant} Subject:[Optional]
'@param {Variant} ReturnReceipt:[Optional]
'*/
Public Function SendMail(Recipients, Subject, ReturnReceipt)
End Function
'/*
'
'The ExportAsFixedFormat method is used to publish
'a workbook to either the PDF or XPS format.
'
'*/
Public Function ExportAsFixedFormat(Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)
End Function
End Class

View File

@ -0,0 +1,109 @@
'/*
'A collection of all the Workbook objects that are currently open in the Microsoft Excel application.
'
'*/
Public Class Workbooks()
'/*
'Creates a new workbook. The new workbook becomes the active workbook.
'
'@param {Variant} Template:[Optional] Determines how the new workbook is created.
'If this argument is a string specifying the name of an existing Microsoft Excel file,
'the new workbook is created with the specified file as a template.
'*/
Public Function Add(Template)
End Function
'/*
'True if Microsoft Excel can check out a specified workbook from a server.
'Read/write Boolean.
'
'@param {String} FileName:[Required] The name of the file to check out.
'
'*/
Public Function CanCheckOut (FileName)
End Function
Public Function CheckOut (FileName)
End Function
Public Function Close ()
End Function
'/*
'
'Opens a workbook.
'
'Example
'Workbooks.Open "ANALYSIS.XLS"
'ActiveWorkbook.RunAutoMacros xlAutoOpen
'*/
Public Function Open (FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad) As Workbook
End Function
'/*
'Returns a Workbook object representing a database.
'*/
Public Function OpenDatabase (FileName, CommandText, CommandType, BackgroundQuery, ImportDataAs)
End Function
'/*
'Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.
'*/
Public Function (FileName, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, TextVisualLayout, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers, Local)
End Function
'/*
'Opens an XML data file. Returns a Workbook object.
'*/
Public Function OpenXML (FileName, Stylesheets, LoadOption)
End Function
'/*
'When used without an object qualifier, this property returns an
'Application object that represents the Microsoft Excel application.
'
'*/
Public Property Application As Application
'/*
'Returns a Long value that represents the number of objects in the collection.
'
'*/
Public Property Count As Long
'/*
'Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
'
'*/
Public Property Creator As Integer
'/*
'Returns a single object from a collection.
'
'*/
Public Property Item(Index) As Object
'/*
'Returns the parent object for the specified object. Read-only.
'
'*/
Public Property Parent As Object
End Class

View File

@ -0,0 +1,86 @@
'/*
'Represents a worksheet.
'
'Example
'
'Worksheets(1).Visible = False
'
'*/
Public Class Worksheet()
'/*
'Makes the current sheet the active sheet.
'
'Example
'ActiveWorkbook.SendMail recipients:="Jean Selva"
'*/
Public Sub Activate()
End Sub
Public Sub Calculate()
End Sub
Public Sub Copy()
End Sub
Public Sub Delete()
End Sub
Public Sub Move()
End Sub
Public Sub Past()
End Sub
Public Sub PastSpecial()
End Sub
Public Sub Select()
End Sub
Public Sub SaveAs()
End Sub
'/*
'
'Returns a Range object that represents a cell or a range of cells.
'
'Example:
'
'Worksheets("Sheet1").Range("A1").Value = 3.14159
'
'*/
Public Property Range As Range
'/*
'
'Returns a Range object that represents all the rows on the specified worksheet.
'
'Example:
'
'Worksheets("Sheet1").Rows(3).Delete
'
'*/
Public Property Row As Range
'/*
'
'Returns a Long value that represents the index number of the
'object within the collection of similar objects.orksheets("Sheet1").Rows(3).Delete
'
'*/
Public Property Index As Long
End Class

View File

@ -0,0 +1,54 @@
'/*
'A collection of all the Worksheet objects in the specified or active workbook. Each Worksheet object represents a worksheet.
'
'Example
'
'Worksheets(1).Visible = False
'
'*/
Public Class Worksheets()
'/*
'Constructor
'
'*/
Public Sub New(Name As String) As Worksheet
End Sub
Public Sub Add()
End Sub
Public Sub Add2()
End Sub
Public Sub Copy()
End Sub
Public Sub Delete()
End Sub
Public Sub Move()
End Sub
Public Sub FillAcrossSheets()
End Sub
Public Sub PrintOut()
End Sub
Public Sub PrintPreview()
End Sub
Public Sub Select()
End Sub
End Class

View File

@ -0,0 +1,15 @@
{
"package": "excel-types",
"version": "1.0.0",
"author": "Alberto Oliveira",
"email": "alberto.aeraph@gmail.comn",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/Aeraphe/excel-types.git"
},
"description": "Creating amazing XVBA packages",
"dependencies": {},
"dev_dependencies": {},
"homepage": "https://github.com/Aeraphe/xvba-cli"
}

View File

@ -0,0 +1,3 @@
{
"files.encoding": "shiftjis"
}

View File

@ -0,0 +1,14 @@
{
"app_name": "XVBA",
"description": "",
"author": "",
"email": "",
"create_ate": "Thu May 29 2025 14:14:10 GMT+0900 (日本標準時)",
"excel_file": "事業計画集計v3.2.xlsm",
"vba_folder": "vba-files",
"ribbon_file": "customUI14",
"ribbon_folder": "ribbons",
"logs": "on",
"xvba_packages": {},
"xvba_dev_packages": {}
}

View File

@ -0,0 +1,15 @@
{
"name": "xvba-app",
"version": "1.0.0",
"description": "A XVBA App",
"main": "index.js",
"author": "LocalSmart",
"license": "ISC",
"dependencies": {
"excel-types": "1.0.0",
"Xlog": "1.0.0"
},
"devDependencies": {
"@localsmart/xvba-cli": "^1.0.2"
}
}

View File

@ -0,0 +1,13 @@
# Changelog
## Xdebug (Under Construction)
- This package provides a way to simulate VBA Immediate Window in Output VSCode window
## [1.0.0b0] - 2020-09-16
### Added
- Create XDebug.printx
- Create XDebug.printError

View File

@ -0,0 +1,58 @@
# Xdebug (VBA Immediate Window in Output VSCode Window)
## Description
- This package provides a way to simulate VBA Immediate Window in Output VSCode window
- Find the Output window (VBA Immediate Window)
## Methods
<p>
<img src="https://github.com/Aeraphe/xdebug/blob/main/images/immediate.gif" alt="VBA immediate Window">
</p>
### Xdebug.printx
- This method print any type os variable
```
Public Sub index()
Dim test(1) As Variant
'Add an Object
Set test(0) = Sheets(1)
'Add a String
test(1) = "Test Xdebug Output"
Xdebug.printx test
End Sub
```
### Xdebug.printError
- This method is use for print error
```
Public Sub index()
On Error GoTo ErrorHandle:
'throw an error
d = 1/0
'Your code here
ErrorHandle:
Xdebug.errorSource = "pageConsoller.index"
Xdebug.printError
End Sub
```

View File

@ -0,0 +1,241 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Xdebug"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'namespace=xvba_modules\Xdebug
Public env As String
'Example of Package Create by XVBA-CLI
Private OS_TMP__FOLDER_PATH As String
Private IMMEDIATE_FOLDER As String
Private IMMEDIATE_FILE As String
Private DEBUG_FILE_PATH As String
Const EMPTY_TYPE = 0
Const NULL_TYPE = 1
Const ERROR_TYPE = 10
Const INTEGER_TYPE = 2
Const LONG_TYPE = 3
Const SINGLE_TYPE = 4
Const DOUBLE_TYPE = 5
Const CURRENCY_TYPE = 6
Const DATE_TYPE = 7
Const DECIMAL_TYPE = 14
Const LONG_LONG_TYPE = 20
Const BOOLEAN_TYPE = 11
Const STRING_TYPE = 8
Const ARRAY_TYPE = 8204
Const OBJECT_TYPE = 9
Const VARIANT_TYPE = 12
Const DATA_OBJECT_TYPE = 13
Private Const MESSAGE_SPACE = " "
Public errorSource As String
Public errorTitle As String
'/*
'Flag for Actrive os Deactive VBA Debug.Print
'*/
Public vbaDebugPrintActive As Boolean
Private Sub class_initialize()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
OS_TMP__FOLDER_PATH = fso.GetSpecialFolder(2)
IMMEDIATE_FOLDER = "xvba_immediate"
IMMEDIATE_FILE = "immediate.txt"
vbaDebugPrintActive = True
errorSource = ""
errorTitle = "XVBA: New Error Was Found"
env = "DEV"
DEBUG_FILE_PATH = OS_TMP__FOLDER_PATH & "\" & IMMEDIATE_FOLDER & "\" & IMMEDIATE_FILE
End Sub
Public Function printx(inputValue As Variant,Optional messageType As Integer = 1)
if(env="DEV") Then
Dim messageText As String
messageText = createOutputMessage(inputValue)
Call writeDebugFileContent(messageText,messageType)
End If
End Function
'/*
'Print A Error
'
'*/
Public Function printError()
if(env="DEV") Then
Dim message As String
message = ErrorHanddler()
Call writeDebugFileContent(message,0)
End If
End Function
'/*
'
'Write Debug ino on File
'
'
'*/
Private Function writeDebugFileContent(messageText,messageType)
Dim filePath As String
Dim FileNum As Integer
Dim PREFIX As String
filePath = DEBUG_FILE_PATH
FileNum = FreeFile
PREFIX = Now & " - "
Open filePath For Append As #FileNum
Dim debugMessage As String
Select Case messageType
Case 0 'Error Message
debugMessage= PREFIX & "Error:" & messageText
Case 1 'Success
debugMessage= PREFIX & messageText
Case Else 'No Type Set
debugMessage= PREFIX & "Info:" & messageText
End Select
Print #FileNum,debugMessage
Close #FileNum
If (vbaDebugPrintActive) Then
Debug.Print debugMessage
End If
End Function
Private Function createOutputMessage(inputValue) As String
Dim typeOfVar As Integer
Dim response As String
typeOfVar = VarType(inputValue)
'Set Error Source Macro/Function name
Err.Source="createOutputMessage"
Select Case typeOfVar
Case STRING_TYPE
response = "String: " & inputValue
Case INTEGER_TYPE
response = "Integer: " & CStr(inputValue)
Case LONG_TYPE
response = "Long: " & CStr(inputValue)
Case SINGLE_TYPE
response = "Single: " & CStr(inputValue)
Case DOUBLE_TYPE
response = "Double: " & CStr(inputValue)
Case CURRENCY_TYPE
response = "Currenty: " & CStr(inputValue)
Case DATE_TYPE
response = "Date: " & CStr(inputValue)
Case DECIMAL_TYPE
response = "Decimal: " & CStr(inputValue)
Case LONG_LONG_TYPE
response = "LongLong: " & CStr(inputValue)
Case BOOLEAN_TYPE
response = "Boolean: " & CStr(inputValue)
Case ARRAY_TYPE
response = makeArrayTypeMessage(inputValue)
Case EMPTY_TYPE
response = "Empty: "
Case OBJECT_TYPE
response = "Object: " & TypeName(inputValue)
Case NULL_TYPE
response = "Null: "
Case ERROR_TYPE
response = "Error: "
Case VARIANT_TYPE
response = "Variant: "
Case DATA_OBJECT_TYPE
response = "Data Object: " & TypeName(inputValue)
Case Else
response = "Type Not Supported yet please inform xvba developer "
Debug.Print typeOfVar
Debug.Print inputValue
End Select
createOutputMessage = response
End Function
Private Function makeArrayTypeMessage(inputValue)As String
Dim nextItem As Variant
Dim response As String
Dim message As String
For Each nextItem In inputValue
message = createOutputMessage(nextItem)
response = response & " [ " & message & " ]" & vbCrLf
Next nextItem
makeArrayTypeMessage = "Array: " & vbCrLf & response
End Function
Private Function ErrorHanddler() As String
Dim errorDescription As String
Dim numberDescription As String
Dim lineError As String
Dim sourceError As String
Dim errorTitleMsg As String
Dim errorSourceMsg As String
errorTitleMsg = vbCrLf & MESSAGE_SPACE & errorTitle
errorSourceMsg = vbCrLf & MESSAGE_SPACE & "Error Source: " & errorSource
Select Case Err.Number
Case 11
numberDescription = vbCrLf & MESSAGE_SPACE & "Error Number: " & Err.Number
lineError = vbCrLf & MESSAGE_SPACE & "Error Line: " & Erl
errorDescription = vbCrLf & MESSAGE_SPACE & "Error Description: " & Err.Description
Case Else
numberDescription = vbCrLf & MESSAGE_SPACE & "Error Number: " & Err.Number
errorDescription = vbCrLf & MESSAGE_SPACE & "Error Description: " & Err.Description
End Select
ErrorHanddler = errorTitleMsg & lineError & errorSourceMsg & numberDescription & errorDescription
End Function

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,15 @@
{
"package": "Xdebug",
"version": "1.0.0",
"author": "Alberto Edaurdo",
"email": "alberto.aeraphe@gmail.com",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/Aeraphe/xdebug.git"
},
"description": "Creating amazing XVBA packages",
"dependencies": {},
"dev_dependencies": {},
"homepage": "www.xvba.dev"
}

View File

@ -0,0 +1,8 @@
# Changelog
## excel@types (Under Construction)
- This package provides a way to use auto-complete for excel class

View File

@ -0,0 +1,51 @@
# Excel VBA type Definitions Package (excel-types)
- This package provides a way to use auto-complete for Excel VBA Class
- You can Create your own vba type definition packages our update this.
- Type definition packages are named like: name-types
- The packages are store in www.xvba.dev
- Ech excel vba class has your own file definition
- The files extension has to be filename.d.vb
- Auto-complete just expose Public types
## Create,install and share VBA Packages With Xvba-cli and Xvba Repository:
- Xvba Repository : <a href="https://www.xvba.dev"> www.xvba.dev</a>
- XVBA-CLI Command Line Interface for XVBA VSCode extension <a href="https://www.npmjs.com/package/@localsmart/xvba-cli">@localsmart/xvba-cli </a>
## Install
- For instal excel-types just use XVBA-CLI install command
```
npx xvba install excel-types
```
## Comments Block
- Use comments blocks below for documenting class/methods/Subs/Functions/Properties
- The comments blocs has to start with '/* and ends with '*/
```
'/*
'Represents the entire Microsoft Excel application.
'
'
'*/
Public Class Application()
```
```
'/*
'Returns a Range object that represents the active cell in the active window
'(the window on top) or in the specified window. If the window isn't displaying
'a worksheet, this property fails. Read-only.
'
'@type {Object.<Range>}
'
'*/
Public Property ActiveCell As Range
```

View File

@ -0,0 +1,147 @@
'/*
'Represents the entire Microsoft Excel application.
'
'
'*/
Public Class Application()
'/*
'Returns an object that represents the active sheet (the sheet on top)
'in the active workbook or in the specified window or workbook.
'Returns Nothing if no sheet is active.
'
'*/
Public Property ActiveSheet As Worksheet
'/*
'Returns a Workbook object that represents the workbook in the
'active window (the window on top).
'Returns Nothing if there are no windows open or if either
'the Info window or the Clipboard window is the active window. Read-only.
'
'
'*/
Public Property ActiveWorkbook As Workbook
'/*
'True if Microsoft Excel displays certain alerts and messages while
'a macro is running. Read/write Boolean.
'
'Example
'Application.DisplayAlerts = False
'Workbooks("BOOK1.XLS").Close
'Application.DisplayAlerts = True
'
'*/
Public Property DisplayAlerts As Boolean
'/*
'Returns or sets an XlCalculation value that represents the calculation mode.
'
'Example
'Application.Calculation = xlCalculationManual
'Application.Calculation = xlAutomatic
'
'@type {XlCalculation}
'*/
Public Property Calculation As XlCalculation
'/*
'True if events are enabled for the specified object. Read/write Boolean.
'
'@type {Boolean}
'*/
Public Property EnableEvents As Boolean
'/*
'True if screen updating is turned on. Read/write Boolean.
'@type {Boolean}
'*/
Public Property ScreenUpdating As Boolean
'/*
'Returns a Range object that represents the active cell in the active window
'(the window on top) or in the specified window. If the window isn't displaying
'a worksheet, this property fails. Read-only.
'
'@type {Object.<Range>}
'
'*/
Public Property ActiveCell As Range
'/*
'Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet).
'An embedded chart is considered active when it's either selected or activated. When no chart is active,
'this property returns Nothing.
'
'Example:
'ActiveChart.HasLegend = True
'
'@type {Object.<Chart>}
'*/
Public Property ActiveChart As Chart
'/*
'Returns a Workbooks collection that represents all the open workbooks. Read-only.
'
'@type {Object.<Collection>} Workbooks Collection
'*/
Public Property ThisWorkbook As Workbook
'/*
'Returns a Workbooks collection that represents all the open workbooks. Read-only.
'
'@type {Object.<Collection>} Workbooks Collection
'*/
Public Property Workbooks As Workbooks
'/*
'Activates a Microsoft application. If the application is already running,
'this method activates the running application.
'If the application isn't running, this method starts a new instance of the application.
'
'Example: (This example starts and activates Word.)
'
'Application.ActivateMicrosoftApp xlMicrosoftWord
'
'@param {XlMSApplication} index
'*/
Public Sub ActivateMicrosoftApp( index As XlMSApplication)
End Sub
'/*
'An event occurs when all pending refresh activity (both synchronous and asynchronous)
'and all of the resultant calculation activities have been completed.
'
'*/
Public Event AfterCalculate()
'/*
'Occurs when a new workbook is created.
'
'Example:
'
'Private Sub App_NewWorkbook(ByVal Wb As Workbook)
'Application.Windows.Arrange xlArrangeStyleTiled End Sub
'
'@param {Workbook} Wb
'*/
Public Event NewWorkbook(ByVal Wb As Workbook)
'/*
'Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
'
'Example:
'Set newSheet = Sheets.Add(Type:=xlWorksheet)
'For i = 1 To Sheets.Count
' newSheet.Cells(i, 1).Value = Sheets(i).Name
' Next i
'
'@type {Sheets}
'*/
Public Property Sheets As Worksheets
End Class

View File

@ -0,0 +1,109 @@
'/*
'
'
'
'/*
Public Class Scripting()
'/*
'
'Object that stores data key/item pairs.
'
'/*
Public Function Dictionary()
End Function
'/*
'
'Adds a new key/item pair to a Dictionary object.
'
'*/
Public Sub Add()
End Sub
'/*
'
'Returns a Boolean value that indicates whether a specified key exists in the Dictionary object.
'
'*/
Public Sub Exists()
End Sub
'/*
'
'Returns an array of all the items in a Dictionary object.
'
'*/
Public Sub Items()
End Sub
'/*
'
'Returns an array of all the keys in a Dictionary object.
'
'*/
Public Sub Keys()
End Sub
'/*
'
'Removes one specified key/item pair from the Dictionary object.
'
'*/
Public Sub Remove()
End Sub
'/*
'
'Removes all the key/item pairs in the Dictionary object.
'
'*/
Public Sub RemoveAll()
End Sub
'/*
'Sets or returns the comparison mode for comparing keys in a Dictionary object.
'
'
'*/
Public Property CompareMode As Variant
'/*
'Returns the number of key/item pairs in a Dictionary object.
'
'
'*/
Public Property Count As Long
'/*
'Sets or returns the value of an item in a Dictionary object.
'
'
'*/
Public Property Item As Variant
'/*
'Sets a new key value for an existing key value in a Dictionary object.
'
'
'*/
Public Property Key As Variant
End Class

View File

@ -0,0 +1,30 @@
'/*
'Contains information about run-time errors.
'
'
'*/
Public Class Err()
'/*
'Returns or sets a string expression containing a
'descriptive string associated with an object. Read/write.
'
'*/
Public Property Description As String
'/*
'Returns or sets a numeric value specifying an error.
'Number is the Err object's default property. Read/write.
'
'*/
Public Property Number As Integer
'/*
'Returns or sets a string expression specifying the name of
'the object or application that originally generated the error. Read/write.
'
'*/
Public Property Source As String
End Class

View File

@ -0,0 +1,547 @@
'/*
'[Conversion Func]
'
'*/
Function Asc()
End Function
'/*
'[Conversion Func]
'Returns a String containing the character associated
'with the specified character code.
'
'Example:
'
'Dim MyChar
'MyChar = Chr(65) ' Returns A.
'MyChar = Chr(97) ' Returns a.
'MyChar = Chr(62) ' Returns >.
'MyChar = Chr(37) ' Returns %.
'*/
Function Chr()
End Function
'/*
'[Conversion Func]
'
'*/
Function Format()
End Function
'/*
'[Conversion Func]
'
'*/
Function Hex()
End Function
'/*
'[Conversion Func]
'
'*/
Function Oct()
End Function
'/*
'[Conversion Func]
'Returns a Variant (String) representation of a number.
'
'Example:
'Dim MyString
'MyString = Str(459) ' Returns " 459".
'MyString = Str(-459.65) ' Returns "-459.65".
'MyString = Str(459.001) ' Returns " 459.001".
'
'*/
Function Str() As Variant
End Function
'/*
'[Conversion Func]
'Returns the numbers contained in a string as
'a numeric value of appropriate type.
'
'Example:
'
'Dim MyValue
'MyValue = Val("2457") ' Returns 2457.
'MyValue = Val(" 2 45 7") ' Returns 2457.
'MyValue = Val("24 and 57") ' Returns 24.
'*/
Function Val(String)
End Function
Function CreateObject()
End Function
Function CurDir()
End Function
'/*
'Returns a Variant (Date) containing the current system date.
'
'Example
'
'Dim MyDate
'MyDate = Date ' MyDate contains the current system date.
'
'*/
Function Date()
End Function
Function DateDiff()
End Function
Function DatePart()
End Function
Function DateSerial()
End Function
Function Day()
End Function
Function DDB()
End Function
Function Dir()
End Function
Function DoEvents()
End Function
Function Environ()
End Function
Function EOF()
End Function
Function Error()
End Function
Function FileAttr()
End Function
Function FileDateTime()
End Function
Function FileLen()
End Function
Function Filter()
End Function
Function FormatCurrency()
End Function
Function FormatDateTime()
End Function
Function FormatNumber()
End Function
Function FormaPercent()
End Function
Function FreeFile()
End Function
Function FV()
End Function
Function GetAllSettings()
End Function
Function GetAttr()
End Function
Function GetObject()
End Function
Function GetSetting()
End Function
Function Hour()
End Function
Function IIf()
End Function
Function IMEStatus()
End Function
Function Input()
End Function
Function InputBox()
End Function
Function InStr()
End Function
Function InStrRev()
End Function
Function IPmt()
End Function
Function IRR()
End Function
Function IsArray()
End Function
Function IsDate()
End Function
'/*
'
'Returns a Boolean value indicating whether a variable has been initialized.
'
'*/
Function IsEmpty()
End Function
Function IsError()
End Function
Function IsMissing()
End Function
Function IsNull()
End Function
Function IsNumeric()
End Function
Function IsObject()
End Function
'/*
'Returns a string created by joining a number of substrings contained in an array.
'
'*/
Function Join()
End Function
Function LBound()
End Function
Function LCase()
End Function
Function Left()
End Function
Function Len()
End Function
Function Loc()
End Function
Function LOF()
End Function
Function LTrim()
End Function
Function RTrim()
End Function
Function Trim()
End Function
Function MacID()
End Function
Function MacScript()
End Function
'/*
'[Math Function]
'Returns a value of the same type that is passed to it specifying the absolute value of a number.
'
'*/
Function Abs()
End Function
'/*
'[Math Function]
'Returns a Double specifying the arctangent of a number.
'
'*/
Function Atn()
End Function
'/*
'[Math Function]
'
'*/
Function Cos()
End Function
'/*
'[Math Function]
'
'*/
Function Exp()
End Function
'/*
'[Math Function]
'
'*/
Function Int()
End Function
'/*
'[Math Function]
'
'*/
Function Fix()
End Function
'/*
'[Math Function]
'
'*/
Function Log()
End Function
'/*
'[Math Function]
'
'*/
Function Rnd()
End Function
'/*
'[Math Function]
'
'*/
Function Sgn()
End Function
'/*
'[Math Function]
'
'*/
Function Sin()
End Function
'/*
'[Math Function]
'
'*/
Function Sqr()
End Function
'/*
'[Math Function]
'
'*/
Function Tan()
End Function
Function Mid()
End Function
Function Minute()
End Function
Function MIRR()
End Function
Function Month()
End Function
Function MonthName()
End Function
'/*
'Displays a message in a dialog box, waits for the user to click a button,
'and returns an Integer indicating which button the user clicked.
'
'*/
Function MsgBox(prompt, [ buttons, ] [ title, ] [ helpfile, context ])
End Function
Function Now()
End Function
Function NPer()
End Function
Function NPV()
End Function
Function PPmt()
End Function
Function QBColor()
End Function
Function Rate()
End Function
'/*
'Returns a string, which is a substring of a string
'expression beginning at the start position (defaults to 1),
'in which a specified substring has been replaced with another
'substring a specified number of times.
'
'*/
Function Replace(expression, find, replace, [ start, [ count, [ compare ]]])
End Function
Function RGB()
End Function
Function Right()
End Function
Function Round()
End Function
Function Second()
End Function
Function Seek()
End Function
Function Shell()
End Function
Function SNL()
End Function
Function Space()
End Function
Function Spc()
End Function
Function Split()
End Function
Function StrComp()
End Function
Function StrConv()
End Function
Function String()
End Function
Function StrReverse()
End Function
Function Switch()
End Function
Function SYD()
End Function
Function Tab()
End Function
Function Time()
End Function
Function Timer()
End Function
Function TimeSerial()
End Function
Function TimeValue()
End Function
Function TypeName()
End Function
Function UBound()
End Function
Function Ucase()
End Function
Function VarType()
End Function
Function Weekday()
End Function
Function WeekdayName()
End Function
Function Year()
End Function

View File

@ -0,0 +1,625 @@
'/*
'Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.
'
'
'*/
Public Class Range()
'/*
'(Range)
'
'Activates a single cell, which must be inside the current selection.
'To select a range of cells, use the Select method.,
'
'Example
'
'This example selects cells A1:C3 on Sheet1 and then makes cell B2 the active cell.
'
' Worksheets("Sheet1").Activate
' Range("A1:C3").Select
' Range("B2").Activate
'
'*/
Public Sub Activate()
End Sub
'/*
'Adds a comment to the range.
'
'Example:
'
'Worksheets(1).Range("E5").AddComment "Current Sales"
'
'@param {String} text
'*/
Public Sub AddComment(text As String)
End Sub
Public Sub AddCommentThreaded()
End Sub
Public Sub AdvancedFilter()
End Sub
Public Sub AllocateChanges()
End Sub
Public Sub ApplyName()
End Sub
Public Sub ApplyOutLineStyles()
End Sub
Public Sub AutoComplete()
End Sub
Public Sub AutoFill()
End Sub
Public Sub AutoFilter()
End Sub
Public Sub AutioFit()
End Sub
Public Sub AutoOutline()
End Sub
Public Sub BorderAround()
End Sub
Public Sub Calculate()
End Sub
Public Sub CalculateRowMajorOrder()
End Sub
Public Sub CheckSpelling()
End Sub
Public Sub Clear()
End Sub
Public Sub ClearComments()
End Sub
Public Sub ClearContents()
End Sub
Public Sub ClearFormats()
End Sub
Public Sub ClearHyperlinks()
End Sub
Public Sub ClearNotes()
End Sub
Public Sub ClearOutline()
End Sub
Public Sub ColumnDifferences()
End Sub
Public Sub Consolidate()
End Sub
Public Sub ConvertToLinkedDataType()
End Sub
Public Sub Copy()
End Sub
Public Sub CopyFromRecordset()
End Sub
Public Sub CopyPicture()
End Sub
Public Sub CreateNames()
End Sub
Public Sub Cut()
End Sub
Public Function DataSeries (Rowcol, Type, Date, Step, Stop, Trend)
End Function
Public Function DataTypeToText()
End Function
Public Function Delete (Shift)
End Function
Public Function DialogBox()
End Function
Public Function Dirty()
End Function
Public Function DiscardChanges()
End Function
Public Function EditionOptions (Type, Option, Name, Reference, Appearance, ChartSize, Format)
End Function
Public Function ExportAsFixedFormat (Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)
End Function
Public Function FillDown()
End Function
Public Function FillLeft()
End Function
Public Function FillRight()
End Function
Public Function FillUp()
End Function
Public Function Find (What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
End Function
Public Function FindNext (After)
End Function
Public Function FindPrevious (Before)
End Function
Public Function FlashFill ()
End Function
Public Function FunctionWizard ()
End Function
Public Function Group (Start, End, By, Periods)
End Function
Public Function Insert (Shift, CopyOrigin)
End Function
Public Function InsertIndent (InsertAmount)
End Function
Public Function Justify()
End Function
Public Function ListNames()
End Function
Public Function Merge(Across)
End Function
Public Function NavigateArrow(TowardPrecedent, ArrowNumber, LinkNumber)
End Function
Public Function NoteText(Text, Start, Length)
End Function
Public Function Parse(ParseLine, Destination)
End Function
Public Function PasteSpecial(Paste, Operation, SkipBlanks, Transpose)
End Function
Public Function PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName)
End Function
Public Function PrintPreview(EnableChanges)
End Function
Public Function RemoveDuplicates(Columns , Header)
End Function
Public Function RemoveSubtotal()
End Function
Public Function Replace(What, Replacement, LookAt, SearchOrder, MatchCase, MatchByte, SearchFormat, ReplaceFormat)
End Function
Public Function RowDifferences(Comparison)
End Function
Public Function Run(Arg1, Arg2, Arg3, Arg4, Arg5...)
End Function
Public Function Select()
End Function
Public Function SetCellDataTypeFromCell(Range, LanguageCulture)
End Function
Public Function SetPhonetic()
End Function
Public Function Show()
End Function
Public Function ShowCard()
End Function
Public Function ShowDependents(Remove)
End Function
Public Function ShowErrors()
End Function
Public Function ShowPrecedents(Remove)
End Function
Public Function Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2, DataOption3)
End Function
Public Function SortSpecial(SortMethod, Key1, Order1, Type, Key2, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, DataOption1, DataOption2, DataOption3)
End Function
Public Function Speak(SpeakDirection, SpeakFormulas)
End Function
Public Function SpecialCells(Type, Value)
End Function
Public Function SubscribeTo(Edition, Format)
End Function
Public Function Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks, SummaryBelowData)
End Function
Public Function Table(RowInput, ColumnInput)
End Function
Public Function TextToColumns(Destination, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers
End Function
Public Function Ungroup()
End Function
Public Function UnMerge()
End Function
Public Property AddIndent As Variant
Public Function Address(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo) As Variant
End Function
Public Function AddressLocal(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo) As Range
End Function
Public Property Application As Application
Public Property Areas As Areas
Public Property Borders As Variant
Public Property Cells As Range
Public Function Characters(Start, Length) As Variant
End Function
Public Property Column As Long
Public Property Columns As Long
Public Property ColumnWidth As Variant
Public Property Comment As Variant
Public Property CommentThreaded As Variant
Public Property Count As Long
Public Property CountLarge As Variant
Public Property Creator As Integer
Public Property CurrentArray As Range
'/*
'Returns a Range object that represents the current region.
'The current region is a range bounded by any combination of blank rows and blank columns. Read-only.
'
'Example
'Worksheets("Sheet1").Activate
'ActiveCell.CurrentRegion.Select
'*/
Public Property CurrentRegion As Range
Public Property Dependents As Range
Public Property DirectDependents As Range
Public Property DirectPrecedents As Range
Public Property DisplayFormat As Object
Public Function End(Direction) As Object
End Function
Public Property EntireColumn As Range
Public Property EntireRow As Range
Public Property Errors As Errors
Public Property Font As Font
Public Property FormatConditions As Range
Public Property Formula As Variant
Public Property FormulaArray As Variant
Public Property FormulaHidden As Variant
Public Property FormulaLocal As Object
Public Property FormulaR1C1 As Varaint
Public Property FormulaR1C1Local As Varaint
Public Property HasArray As Varaint
Public Property HasFormula As Varaint
Public Property HasRichDataType As Varaint
Public Property Height As Double
Public Property Hidden As Variant
Public Property HorizontalAlignment As Variant
Public Property Hyperlinks As Object
Public Property ID As String
Public Property IndentLevel As Variant
Public Property Interior As Double
Public Function Item (RowIndex, ColumnIndex) As Range
End Function
Public Property Left As Variant
Public Property LinkedDataTypeState As Variant
Public Property ListHeaderRows As Variant
Public Property ListObject As Object
Public Property LocationInTable As Variant
Public Property Locked As Variant
Public Property MDX As String
Public Property MergeArea As Range
Public Property MergeCells As Boolean
Public Property Name As Variant
Public Property Next As Range
Public Property NumberFormat As Variant
Public Property NumberFormatLocal As Variant
Public Function Offset (RowOffset, ColumnOffset) As Range
End Function
Public Property Orientation As Variant
Public Property OutlineLevel As Variant
Public Property PageBreak As Variant
Public Property Parent As Variant
Public Property Phonetic As Variant
Public Property Phonetics As Variant
Public Property PivotCell As Variant
Public Property PivotField As Variant
Public Property PivotItem As Variant
Public Property PivotTable As Variant
Public Property Precedents As Range
Public Property PrefixCharacter As Variant
Public Property Previous As Range
Public Property QueryTable As Variant
Public Function Range (Cell1, Cell2) As Range
End Function
Public Property ReadingOrder As Variant
Public Function Resize (RowSize, ColumnSize) As Range
End Function
Public Property Row As Long
Public Property RowHeight As Double
Public Property Rows As Range
Public Property ServerActions As Variant
Public Property ShowDetail As Variant
Public Property ShrinkToFit As Variant
Public Property SoundNote As Variant
Public Property SparklineGroups As Variant
Public Property Style As Variant
Public Property Summary As Variant
Public Property Text As String
Public Property Top As Variant
Public Property UseStandardHeight As Variant
Public Property UseStandardWidth As Variant
Public Property Validation As Variant
Public Function Value (RangeValueDataType) As Variant
End Function
Public Property Value2 As Variant
Public Property VerticalAlignment As Variant
Public Property Width As Double
Public Property Worksheet As Worksheet
Public Property WrapText As Variant
Public Property XPath As XPath
End Class

View File

@ -0,0 +1,157 @@
'/*
'Represents a Microsoft Excel workbook.
'
'
'*/
Public Class Workbook()
'/*
'Returns a String that represents the complete path to the
'workbook/file that this workbook object represents.
'
'*/
Public Property Path As String
Public Property Worksheets As Worksheet
'/*
'True if a backup file is created when this file is saved. Read-only Boolean.
'
'@type {Boolean}
'*/
Public Property CreateBackup As Boolean
'/*
'Returns a String value that represents the name of the object.
'
'@type {Boolean}
'*/
Public Property Name As String
'/*
'True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean.
'
'Example:
'If Not ActiveWorkbook.Saved Then
' MsgBox "This workbook contains unsaved changes."
'End If
'
'@type {Boolean}
'*/
Public Property Saved As String
'/*
'Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
'
'Example:
'Set newSheet = Sheets.Add(Type:=xlWorksheet)
'For i = 1 To Sheets.Count
' newSheet.Cells(i, 1).Value = Sheets(i).Name
' Next i
'
'@type {Sheets}
'*/
Public Property Sheets As Worksheets
'/*
'
'Activates the first window associated with the workbook.
'
'*/
Public Function Activate()
End Function
'/*
'
'Closes the object.
'
'Example
'
'Workbooks("BOOK1.XLS").Close SaveChanges:=False
'
'@param {Variant} SaveChanges:[Optional] True or false
'@param {Variant} FileName:[Optional] Saves changes under this file name.
'@param {Variant} RouteWorkbook:[Optional] True or False
'*/
Public Function Close(SaveChanges,FileName,RouteWorkbook)
End Function
'/*
'Saves changes to the specified workbook.
'*/
Public Function Save()
End Function
'/*
'Saves changes to the workbook in a different file.
'
'@param {Variant} FileName:[Optional]
'@param {Variant} FileFormat:[Optional]
'@param {Variant} Password:[Optional]
'@param {Variant} WriteResPassword:[Optional]
'@param {Variant} ReadOnlyRecommended:[Optional]
'@param {Variant} CreateBackup:[Optional]
'@param {Variant} AccessMode:[Optional]
'@param {Variant} ConflictResolution:[Optional]
'@param {Variant} AddToMru:[Optional]
'@param {Variant} TextCodepage:[Optional]
'@param {Variant} TextVisualLayout:[Optional]
'@param {Variant} Local:[Optional]
'*/
Public Function SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)
End Function
'/*
'Exports the data that has been mapped to the specified XML schema map to an XML data file.
'
'@param {String} FileName:[Required]
'@param {XmlMap} Map:[Required]
'*/
Public Function SaveAsXMLData(FileName, Map)
End Function
'/*
'Saves a copy of the workbook to a file but doesn't modify the open workbook in memory.
'
'Example
'ActiveWorkbook.SaveCopyAs "C:\TEMP\XXXX.XLS"
'
'@param {Variant} FileName:[Required]
'*/
Public Function SaveCopyAs(FileName, Map)
End Function
'/*
'Sends the workbook by using the installed mail system.
'
'Example
'ActiveWorkbook.SendMail recipients:="Jean Selva"
'
'@param {Variant} Recipients:[Required]
'@param {Variant} Subject:[Optional]
'@param {Variant} ReturnReceipt:[Optional]
'*/
Public Function SendMail(Recipients, Subject, ReturnReceipt)
End Function
'/*
'
'The ExportAsFixedFormat method is used to publish
'a workbook to either the PDF or XPS format.
'
'*/
Public Function ExportAsFixedFormat(Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)
End Function
End Class

View File

@ -0,0 +1,109 @@
'/*
'A collection of all the Workbook objects that are currently open in the Microsoft Excel application.
'
'*/
Public Class Workbooks()
'/*
'Creates a new workbook. The new workbook becomes the active workbook.
'
'@param {Variant} Template:[Optional] Determines how the new workbook is created.
'If this argument is a string specifying the name of an existing Microsoft Excel file,
'the new workbook is created with the specified file as a template.
'*/
Public Function Add(Template)
End Function
'/*
'True if Microsoft Excel can check out a specified workbook from a server.
'Read/write Boolean.
'
'@param {String} FileName:[Required] The name of the file to check out.
'
'*/
Public Function CanCheckOut (FileName)
End Function
Public Function CheckOut (FileName)
End Function
Public Function Close ()
End Function
'/*
'
'Opens a workbook.
'
'Example
'Workbooks.Open "ANALYSIS.XLS"
'ActiveWorkbook.RunAutoMacros xlAutoOpen
'*/
Public Function Open (FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad) As Workbook
End Function
'/*
'Returns a Workbook object representing a database.
'*/
Public Function OpenDatabase (FileName, CommandText, CommandType, BackgroundQuery, ImportDataAs)
End Function
'/*
'Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.
'*/
Public Function (FileName, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, TextVisualLayout, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers, Local)
End Function
'/*
'Opens an XML data file. Returns a Workbook object.
'*/
Public Function OpenXML (FileName, Stylesheets, LoadOption)
End Function
'/*
'When used without an object qualifier, this property returns an
'Application object that represents the Microsoft Excel application.
'
'*/
Public Property Application As Application
'/*
'Returns a Long value that represents the number of objects in the collection.
'
'*/
Public Property Count As Long
'/*
'Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
'
'*/
Public Property Creator As Integer
'/*
'Returns a single object from a collection.
'
'*/
Public Property Item(Index) As Object
'/*
'Returns the parent object for the specified object. Read-only.
'
'*/
Public Property Parent As Object
End Class

View File

@ -0,0 +1,86 @@
'/*
'Represents a worksheet.
'
'Example
'
'Worksheets(1).Visible = False
'
'*/
Public Class Worksheet()
'/*
'Makes the current sheet the active sheet.
'
'Example
'ActiveWorkbook.SendMail recipients:="Jean Selva"
'*/
Public Sub Activate()
End Sub
Public Sub Calculate()
End Sub
Public Sub Copy()
End Sub
Public Sub Delete()
End Sub
Public Sub Move()
End Sub
Public Sub Past()
End Sub
Public Sub PastSpecial()
End Sub
Public Sub Select()
End Sub
Public Sub SaveAs()
End Sub
'/*
'
'Returns a Range object that represents a cell or a range of cells.
'
'Example:
'
'Worksheets("Sheet1").Range("A1").Value = 3.14159
'
'*/
Public Property Range As Range
'/*
'
'Returns a Range object that represents all the rows on the specified worksheet.
'
'Example:
'
'Worksheets("Sheet1").Rows(3).Delete
'
'*/
Public Property Row As Range
'/*
'
'Returns a Long value that represents the index number of the
'object within the collection of similar objects.orksheets("Sheet1").Rows(3).Delete
'
'*/
Public Property Index As Long
End Class

View File

@ -0,0 +1,54 @@
'/*
'A collection of all the Worksheet objects in the specified or active workbook. Each Worksheet object represents a worksheet.
'
'Example
'
'Worksheets(1).Visible = False
'
'*/
Public Class Worksheets()
'/*
'Constructor
'
'*/
Public Sub New(Name As String) As Worksheet
End Sub
Public Sub Add()
End Sub
Public Sub Add2()
End Sub
Public Sub Copy()
End Sub
Public Sub Delete()
End Sub
Public Sub Move()
End Sub
Public Sub FillAcrossSheets()
End Sub
Public Sub PrintOut()
End Sub
Public Sub PrintPreview()
End Sub
Public Sub Select()
End Sub
End Class

View File

@ -0,0 +1,15 @@
{
"package": "excel-types",
"version": "1.0.0",
"author": "Alberto Oliveira",
"email": "alberto.aeraph@gmail.comn",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/Aeraphe/excel-types.git"
},
"description": "Creating amazing XVBA packages",
"dependencies": {},
"dev_dependencies": {},
"homepage": "https://github.com/Aeraphe/xvba-cli"
}

View File

@ -0,0 +1,3 @@
{
"files.encoding": "shiftjis"
}

View File

@ -0,0 +1,14 @@
{
"app_name": "XVBA",
"description": "",
"author": "",
"email": "",
"create_ate": "Thu May 29 2025 16:42:04 GMT+0900 (日本標準時)",
"excel_file": "データ取得汎用ツール.xlsm",
"vba_folder": "vba-files",
"ribbon_file": "customUI14",
"ribbon_folder": "ribbons",
"logs": "on",
"xvba_packages": {},
"xvba_dev_packages": {}
}

View File

@ -0,0 +1,15 @@
{
"name": "xvba-app",
"version": "1.0.0",
"description": "A XVBA App",
"main": "index.js",
"author": "LocalSmart",
"license": "ISC",
"dependencies": {
"excel-types": "1.0.0",
"Xlog": "1.0.0"
},
"devDependencies": {
"@localsmart/xvba-cli": "^1.0.2"
}
}

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Sheet1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

View File

@ -0,0 +1,11 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "ThisWorkbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = True
Option Explicit

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
Attribute VB_Name = "Module1"
Option Explicit
'Web APIへJSONパラメータを付与してデータを取得する関数
Public Sub FetchDataFromWebAPI(recordId As String)
'APIキーを設定
Dim apiKey As String
apiKey = "6504c8a807677a3a576e10327f3c19876c55736ee45d4a845796b9e7f5e087bfd4bd0d8184863da8cf1733ca635111432ab334aea59102b06a96ee6d2c05190d"
Dim http As Object
Dim url As String
Dim response As String
Dim jsonBody As String
Dim postData As Object
Dim jsonRes As Object
'VBA-JSONのDictionaryを利用
Set postData = CreateObject("Scripting.Dictionary")
postData("ApiVersion") = "1.1"
postData("ApiKey") = apiKey
'JsonConverter.ConvertToJsonでJSON文字列に変換
jsonBody = JsonConverter.ConvertToJson(postData)
'url = "https://jsonplaceholder.typicode.com/todos" " POST用のエンドポイント例
url = "https://nextoffice.Next-hd.co.jp/pleasanter/api/items/" & recordId & "/Get"
Debug.Print "URL: " & url
Debug.Print "JSON Body: " & jsonBody
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "POST", url, False
http.setRequestHeader "Content-Type", "application/json"
http.send jsonBody
Debug.Print http.Status & " " & http.statusText
If http.Status = 201 Or http.Status = 200 Then
response = http.responseText
'レスポンスをJSONとしてパース
Set jsonRes = JsonConverter.ParseJson(response)
Debug.Print "取得データ: " & jsonRes("Response")("Data")(1)("Title")
Else
MsgBox "エラー: " & http.Status & " - " & http.statusText
End If
Set http = Nothing
End Sub
'FetchDataFromWebAPIを呼び出す例
Public Sub TestFetchData()
Dim recordId As String
recordId = "119261" '適切なレコードIDに置き換えてください
FetchDataFromWebAPI recordId
End Sub

View File

@ -0,0 +1,13 @@
# Changelog
## Xdebug (Under Construction)
- This package provides a way to simulate VBA Immediate Window in Output VSCode window
## [1.0.0b0] - 2020-09-16
### Added
- Create XDebug.printx
- Create XDebug.printError

View File

@ -0,0 +1,58 @@
# Xdebug (VBA Immediate Window in Output VSCode Window)
## Description
- This package provides a way to simulate VBA Immediate Window in Output VSCode window
- Find the Output window (VBA Immediate Window)
## Methods
<p>
<img src="https://github.com/Aeraphe/xdebug/blob/main/images/immediate.gif" alt="VBA immediate Window">
</p>
### Xdebug.printx
- This method print any type os variable
```
Public Sub index()
Dim test(1) As Variant
'Add an Object
Set test(0) = Sheets(1)
'Add a String
test(1) = "Test Xdebug Output"
Xdebug.printx test
End Sub
```
### Xdebug.printError
- This method is use for print error
```
Public Sub index()
On Error GoTo ErrorHandle:
'throw an error
d = 1/0
'Your code here
ErrorHandle:
Xdebug.errorSource = "pageConsoller.index"
Xdebug.printError
End Sub
```

View File

@ -0,0 +1,241 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "Xdebug"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'namespace=xvba_modules\Xdebug
Public env As String
'Example of Package Create by XVBA-CLI
Private OS_TMP__FOLDER_PATH As String
Private IMMEDIATE_FOLDER As String
Private IMMEDIATE_FILE As String
Private DEBUG_FILE_PATH As String
Const EMPTY_TYPE = 0
Const NULL_TYPE = 1
Const ERROR_TYPE = 10
Const INTEGER_TYPE = 2
Const LONG_TYPE = 3
Const SINGLE_TYPE = 4
Const DOUBLE_TYPE = 5
Const CURRENCY_TYPE = 6
Const DATE_TYPE = 7
Const DECIMAL_TYPE = 14
Const LONG_LONG_TYPE = 20
Const BOOLEAN_TYPE = 11
Const STRING_TYPE = 8
Const ARRAY_TYPE = 8204
Const OBJECT_TYPE = 9
Const VARIANT_TYPE = 12
Const DATA_OBJECT_TYPE = 13
Private Const MESSAGE_SPACE = " "
Public errorSource As String
Public errorTitle As String
'/*
'Flag for Actrive os Deactive VBA Debug.Print
'*/
Public vbaDebugPrintActive As Boolean
Private Sub class_initialize()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
OS_TMP__FOLDER_PATH = fso.GetSpecialFolder(2)
IMMEDIATE_FOLDER = "xvba_immediate"
IMMEDIATE_FILE = "immediate.txt"
vbaDebugPrintActive = True
errorSource = ""
errorTitle = "XVBA: New Error Was Found"
env = "DEV"
DEBUG_FILE_PATH = OS_TMP__FOLDER_PATH & "\" & IMMEDIATE_FOLDER & "\" & IMMEDIATE_FILE
End Sub
Public Function printx(inputValue As Variant,Optional messageType As Integer = 1)
if(env="DEV") Then
Dim messageText As String
messageText = createOutputMessage(inputValue)
Call writeDebugFileContent(messageText,messageType)
End If
End Function
'/*
'Print A Error
'
'*/
Public Function printError()
if(env="DEV") Then
Dim message As String
message = ErrorHanddler()
Call writeDebugFileContent(message,0)
End If
End Function
'/*
'
'Write Debug ino on File
'
'
'*/
Private Function writeDebugFileContent(messageText,messageType)
Dim filePath As String
Dim FileNum As Integer
Dim PREFIX As String
filePath = DEBUG_FILE_PATH
FileNum = FreeFile
PREFIX = Now & " - "
Open filePath For Append As #FileNum
Dim debugMessage As String
Select Case messageType
Case 0 'Error Message
debugMessage= PREFIX & "Error:" & messageText
Case 1 'Success
debugMessage= PREFIX & messageText
Case Else 'No Type Set
debugMessage= PREFIX & "Info:" & messageText
End Select
Print #FileNum,debugMessage
Close #FileNum
If (vbaDebugPrintActive) Then
Debug.Print debugMessage
End If
End Function
Private Function createOutputMessage(inputValue) As String
Dim typeOfVar As Integer
Dim response As String
typeOfVar = VarType(inputValue)
'Set Error Source Macro/Function name
Err.Source="createOutputMessage"
Select Case typeOfVar
Case STRING_TYPE
response = "String: " & inputValue
Case INTEGER_TYPE
response = "Integer: " & CStr(inputValue)
Case LONG_TYPE
response = "Long: " & CStr(inputValue)
Case SINGLE_TYPE
response = "Single: " & CStr(inputValue)
Case DOUBLE_TYPE
response = "Double: " & CStr(inputValue)
Case CURRENCY_TYPE
response = "Currenty: " & CStr(inputValue)
Case DATE_TYPE
response = "Date: " & CStr(inputValue)
Case DECIMAL_TYPE
response = "Decimal: " & CStr(inputValue)
Case LONG_LONG_TYPE
response = "LongLong: " & CStr(inputValue)
Case BOOLEAN_TYPE
response = "Boolean: " & CStr(inputValue)
Case ARRAY_TYPE
response = makeArrayTypeMessage(inputValue)
Case EMPTY_TYPE
response = "Empty: "
Case OBJECT_TYPE
response = "Object: " & TypeName(inputValue)
Case NULL_TYPE
response = "Null: "
Case ERROR_TYPE
response = "Error: "
Case VARIANT_TYPE
response = "Variant: "
Case DATA_OBJECT_TYPE
response = "Data Object: " & TypeName(inputValue)
Case Else
response = "Type Not Supported yet please inform xvba developer "
Debug.Print typeOfVar
Debug.Print inputValue
End Select
createOutputMessage = response
End Function
Private Function makeArrayTypeMessage(inputValue)As String
Dim nextItem As Variant
Dim response As String
Dim message As String
For Each nextItem In inputValue
message = createOutputMessage(nextItem)
response = response & " [ " & message & " ]" & vbCrLf
Next nextItem
makeArrayTypeMessage = "Array: " & vbCrLf & response
End Function
Private Function ErrorHanddler() As String
Dim errorDescription As String
Dim numberDescription As String
Dim lineError As String
Dim sourceError As String
Dim errorTitleMsg As String
Dim errorSourceMsg As String
errorTitleMsg = vbCrLf & MESSAGE_SPACE & errorTitle
errorSourceMsg = vbCrLf & MESSAGE_SPACE & "Error Source: " & errorSource
Select Case Err.Number
Case 11
numberDescription = vbCrLf & MESSAGE_SPACE & "Error Number: " & Err.Number
lineError = vbCrLf & MESSAGE_SPACE & "Error Line: " & Erl
errorDescription = vbCrLf & MESSAGE_SPACE & "Error Description: " & Err.Description
Case Else
numberDescription = vbCrLf & MESSAGE_SPACE & "Error Number: " & Err.Number
errorDescription = vbCrLf & MESSAGE_SPACE & "Error Description: " & Err.Description
End Select
ErrorHanddler = errorTitleMsg & lineError & errorSourceMsg & numberDescription & errorDescription
End Function

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,15 @@
{
"package": "Xdebug",
"version": "1.0.0",
"author": "Alberto Edaurdo",
"email": "alberto.aeraphe@gmail.com",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/Aeraphe/xdebug.git"
},
"description": "Creating amazing XVBA packages",
"dependencies": {},
"dev_dependencies": {},
"homepage": "www.xvba.dev"
}

View File

@ -0,0 +1,8 @@
# Changelog
## excel@types (Under Construction)
- This package provides a way to use auto-complete for excel class

View File

@ -0,0 +1,51 @@
# Excel VBA type Definitions Package (excel-types)
- This package provides a way to use auto-complete for Excel VBA Class
- You can Create your own vba type definition packages our update this.
- Type definition packages are named like: name-types
- The packages are store in www.xvba.dev
- Ech excel vba class has your own file definition
- The files extension has to be filename.d.vb
- Auto-complete just expose Public types
## Create,install and share VBA Packages With Xvba-cli and Xvba Repository:
- Xvba Repository : <a href="https://www.xvba.dev"> www.xvba.dev</a>
- XVBA-CLI Command Line Interface for XVBA VSCode extension <a href="https://www.npmjs.com/package/@localsmart/xvba-cli">@localsmart/xvba-cli </a>
## Install
- For instal excel-types just use XVBA-CLI install command
```
npx xvba install excel-types
```
## Comments Block
- Use comments blocks below for documenting class/methods/Subs/Functions/Properties
- The comments blocs has to start with '/* and ends with '*/
```
'/*
'Represents the entire Microsoft Excel application.
'
'
'*/
Public Class Application()
```
```
'/*
'Returns a Range object that represents the active cell in the active window
'(the window on top) or in the specified window. If the window isn't displaying
'a worksheet, this property fails. Read-only.
'
'@type {Object.<Range>}
'
'*/
Public Property ActiveCell As Range
```

View File

@ -0,0 +1,147 @@
'/*
'Represents the entire Microsoft Excel application.
'
'
'*/
Public Class Application()
'/*
'Returns an object that represents the active sheet (the sheet on top)
'in the active workbook or in the specified window or workbook.
'Returns Nothing if no sheet is active.
'
'*/
Public Property ActiveSheet As Worksheet
'/*
'Returns a Workbook object that represents the workbook in the
'active window (the window on top).
'Returns Nothing if there are no windows open or if either
'the Info window or the Clipboard window is the active window. Read-only.
'
'
'*/
Public Property ActiveWorkbook As Workbook
'/*
'True if Microsoft Excel displays certain alerts and messages while
'a macro is running. Read/write Boolean.
'
'Example
'Application.DisplayAlerts = False
'Workbooks("BOOK1.XLS").Close
'Application.DisplayAlerts = True
'
'*/
Public Property DisplayAlerts As Boolean
'/*
'Returns or sets an XlCalculation value that represents the calculation mode.
'
'Example
'Application.Calculation = xlCalculationManual
'Application.Calculation = xlAutomatic
'
'@type {XlCalculation}
'*/
Public Property Calculation As XlCalculation
'/*
'True if events are enabled for the specified object. Read/write Boolean.
'
'@type {Boolean}
'*/
Public Property EnableEvents As Boolean
'/*
'True if screen updating is turned on. Read/write Boolean.
'@type {Boolean}
'*/
Public Property ScreenUpdating As Boolean
'/*
'Returns a Range object that represents the active cell in the active window
'(the window on top) or in the specified window. If the window isn't displaying
'a worksheet, this property fails. Read-only.
'
'@type {Object.<Range>}
'
'*/
Public Property ActiveCell As Range
'/*
'Returns a Chart object that represents the active chart (either an embedded chart or a chart sheet).
'An embedded chart is considered active when it's either selected or activated. When no chart is active,
'this property returns Nothing.
'
'Example:
'ActiveChart.HasLegend = True
'
'@type {Object.<Chart>}
'*/
Public Property ActiveChart As Chart
'/*
'Returns a Workbooks collection that represents all the open workbooks. Read-only.
'
'@type {Object.<Collection>} Workbooks Collection
'*/
Public Property ThisWorkbook As Workbook
'/*
'Returns a Workbooks collection that represents all the open workbooks. Read-only.
'
'@type {Object.<Collection>} Workbooks Collection
'*/
Public Property Workbooks As Workbooks
'/*
'Activates a Microsoft application. If the application is already running,
'this method activates the running application.
'If the application isn't running, this method starts a new instance of the application.
'
'Example: (This example starts and activates Word.)
'
'Application.ActivateMicrosoftApp xlMicrosoftWord
'
'@param {XlMSApplication} index
'*/
Public Sub ActivateMicrosoftApp( index As XlMSApplication)
End Sub
'/*
'An event occurs when all pending refresh activity (both synchronous and asynchronous)
'and all of the resultant calculation activities have been completed.
'
'*/
Public Event AfterCalculate()
'/*
'Occurs when a new workbook is created.
'
'Example:
'
'Private Sub App_NewWorkbook(ByVal Wb As Workbook)
'Application.Windows.Arrange xlArrangeStyleTiled End Sub
'
'@param {Workbook} Wb
'*/
Public Event NewWorkbook(ByVal Wb As Workbook)
'/*
'Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
'
'Example:
'Set newSheet = Sheets.Add(Type:=xlWorksheet)
'For i = 1 To Sheets.Count
' newSheet.Cells(i, 1).Value = Sheets(i).Name
' Next i
'
'@type {Sheets}
'*/
Public Property Sheets As Worksheets
End Class

View File

@ -0,0 +1,109 @@
'/*
'
'
'
'/*
Public Class Scripting()
'/*
'
'Object that stores data key/item pairs.
'
'/*
Public Function Dictionary()
End Function
'/*
'
'Adds a new key/item pair to a Dictionary object.
'
'*/
Public Sub Add()
End Sub
'/*
'
'Returns a Boolean value that indicates whether a specified key exists in the Dictionary object.
'
'*/
Public Sub Exists()
End Sub
'/*
'
'Returns an array of all the items in a Dictionary object.
'
'*/
Public Sub Items()
End Sub
'/*
'
'Returns an array of all the keys in a Dictionary object.
'
'*/
Public Sub Keys()
End Sub
'/*
'
'Removes one specified key/item pair from the Dictionary object.
'
'*/
Public Sub Remove()
End Sub
'/*
'
'Removes all the key/item pairs in the Dictionary object.
'
'*/
Public Sub RemoveAll()
End Sub
'/*
'Sets or returns the comparison mode for comparing keys in a Dictionary object.
'
'
'*/
Public Property CompareMode As Variant
'/*
'Returns the number of key/item pairs in a Dictionary object.
'
'
'*/
Public Property Count As Long
'/*
'Sets or returns the value of an item in a Dictionary object.
'
'
'*/
Public Property Item As Variant
'/*
'Sets a new key value for an existing key value in a Dictionary object.
'
'
'*/
Public Property Key As Variant
End Class

View File

@ -0,0 +1,30 @@
'/*
'Contains information about run-time errors.
'
'
'*/
Public Class Err()
'/*
'Returns or sets a string expression containing a
'descriptive string associated with an object. Read/write.
'
'*/
Public Property Description As String
'/*
'Returns or sets a numeric value specifying an error.
'Number is the Err object's default property. Read/write.
'
'*/
Public Property Number As Integer
'/*
'Returns or sets a string expression specifying the name of
'the object or application that originally generated the error. Read/write.
'
'*/
Public Property Source As String
End Class

View File

@ -0,0 +1,547 @@
'/*
'[Conversion Func]
'
'*/
Function Asc()
End Function
'/*
'[Conversion Func]
'Returns a String containing the character associated
'with the specified character code.
'
'Example:
'
'Dim MyChar
'MyChar = Chr(65) ' Returns A.
'MyChar = Chr(97) ' Returns a.
'MyChar = Chr(62) ' Returns >.
'MyChar = Chr(37) ' Returns %.
'*/
Function Chr()
End Function
'/*
'[Conversion Func]
'
'*/
Function Format()
End Function
'/*
'[Conversion Func]
'
'*/
Function Hex()
End Function
'/*
'[Conversion Func]
'
'*/
Function Oct()
End Function
'/*
'[Conversion Func]
'Returns a Variant (String) representation of a number.
'
'Example:
'Dim MyString
'MyString = Str(459) ' Returns " 459".
'MyString = Str(-459.65) ' Returns "-459.65".
'MyString = Str(459.001) ' Returns " 459.001".
'
'*/
Function Str() As Variant
End Function
'/*
'[Conversion Func]
'Returns the numbers contained in a string as
'a numeric value of appropriate type.
'
'Example:
'
'Dim MyValue
'MyValue = Val("2457") ' Returns 2457.
'MyValue = Val(" 2 45 7") ' Returns 2457.
'MyValue = Val("24 and 57") ' Returns 24.
'*/
Function Val(String)
End Function
Function CreateObject()
End Function
Function CurDir()
End Function
'/*
'Returns a Variant (Date) containing the current system date.
'
'Example
'
'Dim MyDate
'MyDate = Date ' MyDate contains the current system date.
'
'*/
Function Date()
End Function
Function DateDiff()
End Function
Function DatePart()
End Function
Function DateSerial()
End Function
Function Day()
End Function
Function DDB()
End Function
Function Dir()
End Function
Function DoEvents()
End Function
Function Environ()
End Function
Function EOF()
End Function
Function Error()
End Function
Function FileAttr()
End Function
Function FileDateTime()
End Function
Function FileLen()
End Function
Function Filter()
End Function
Function FormatCurrency()
End Function
Function FormatDateTime()
End Function
Function FormatNumber()
End Function
Function FormaPercent()
End Function
Function FreeFile()
End Function
Function FV()
End Function
Function GetAllSettings()
End Function
Function GetAttr()
End Function
Function GetObject()
End Function
Function GetSetting()
End Function
Function Hour()
End Function
Function IIf()
End Function
Function IMEStatus()
End Function
Function Input()
End Function
Function InputBox()
End Function
Function InStr()
End Function
Function InStrRev()
End Function
Function IPmt()
End Function
Function IRR()
End Function
Function IsArray()
End Function
Function IsDate()
End Function
'/*
'
'Returns a Boolean value indicating whether a variable has been initialized.
'
'*/
Function IsEmpty()
End Function
Function IsError()
End Function
Function IsMissing()
End Function
Function IsNull()
End Function
Function IsNumeric()
End Function
Function IsObject()
End Function
'/*
'Returns a string created by joining a number of substrings contained in an array.
'
'*/
Function Join()
End Function
Function LBound()
End Function
Function LCase()
End Function
Function Left()
End Function
Function Len()
End Function
Function Loc()
End Function
Function LOF()
End Function
Function LTrim()
End Function
Function RTrim()
End Function
Function Trim()
End Function
Function MacID()
End Function
Function MacScript()
End Function
'/*
'[Math Function]
'Returns a value of the same type that is passed to it specifying the absolute value of a number.
'
'*/
Function Abs()
End Function
'/*
'[Math Function]
'Returns a Double specifying the arctangent of a number.
'
'*/
Function Atn()
End Function
'/*
'[Math Function]
'
'*/
Function Cos()
End Function
'/*
'[Math Function]
'
'*/
Function Exp()
End Function
'/*
'[Math Function]
'
'*/
Function Int()
End Function
'/*
'[Math Function]
'
'*/
Function Fix()
End Function
'/*
'[Math Function]
'
'*/
Function Log()
End Function
'/*
'[Math Function]
'
'*/
Function Rnd()
End Function
'/*
'[Math Function]
'
'*/
Function Sgn()
End Function
'/*
'[Math Function]
'
'*/
Function Sin()
End Function
'/*
'[Math Function]
'
'*/
Function Sqr()
End Function
'/*
'[Math Function]
'
'*/
Function Tan()
End Function
Function Mid()
End Function
Function Minute()
End Function
Function MIRR()
End Function
Function Month()
End Function
Function MonthName()
End Function
'/*
'Displays a message in a dialog box, waits for the user to click a button,
'and returns an Integer indicating which button the user clicked.
'
'*/
Function MsgBox(prompt, [ buttons, ] [ title, ] [ helpfile, context ])
End Function
Function Now()
End Function
Function NPer()
End Function
Function NPV()
End Function
Function PPmt()
End Function
Function QBColor()
End Function
Function Rate()
End Function
'/*
'Returns a string, which is a substring of a string
'expression beginning at the start position (defaults to 1),
'in which a specified substring has been replaced with another
'substring a specified number of times.
'
'*/
Function Replace(expression, find, replace, [ start, [ count, [ compare ]]])
End Function
Function RGB()
End Function
Function Right()
End Function
Function Round()
End Function
Function Second()
End Function
Function Seek()
End Function
Function Shell()
End Function
Function SNL()
End Function
Function Space()
End Function
Function Spc()
End Function
Function Split()
End Function
Function StrComp()
End Function
Function StrConv()
End Function
Function String()
End Function
Function StrReverse()
End Function
Function Switch()
End Function
Function SYD()
End Function
Function Tab()
End Function
Function Time()
End Function
Function Timer()
End Function
Function TimeSerial()
End Function
Function TimeValue()
End Function
Function TypeName()
End Function
Function UBound()
End Function
Function Ucase()
End Function
Function VarType()
End Function
Function Weekday()
End Function
Function WeekdayName()
End Function
Function Year()
End Function

View File

@ -0,0 +1,625 @@
'/*
'Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.
'
'
'*/
Public Class Range()
'/*
'(Range)
'
'Activates a single cell, which must be inside the current selection.
'To select a range of cells, use the Select method.,
'
'Example
'
'This example selects cells A1:C3 on Sheet1 and then makes cell B2 the active cell.
'
' Worksheets("Sheet1").Activate
' Range("A1:C3").Select
' Range("B2").Activate
'
'*/
Public Sub Activate()
End Sub
'/*
'Adds a comment to the range.
'
'Example:
'
'Worksheets(1).Range("E5").AddComment "Current Sales"
'
'@param {String} text
'*/
Public Sub AddComment(text As String)
End Sub
Public Sub AddCommentThreaded()
End Sub
Public Sub AdvancedFilter()
End Sub
Public Sub AllocateChanges()
End Sub
Public Sub ApplyName()
End Sub
Public Sub ApplyOutLineStyles()
End Sub
Public Sub AutoComplete()
End Sub
Public Sub AutoFill()
End Sub
Public Sub AutoFilter()
End Sub
Public Sub AutioFit()
End Sub
Public Sub AutoOutline()
End Sub
Public Sub BorderAround()
End Sub
Public Sub Calculate()
End Sub
Public Sub CalculateRowMajorOrder()
End Sub
Public Sub CheckSpelling()
End Sub
Public Sub Clear()
End Sub
Public Sub ClearComments()
End Sub
Public Sub ClearContents()
End Sub
Public Sub ClearFormats()
End Sub
Public Sub ClearHyperlinks()
End Sub
Public Sub ClearNotes()
End Sub
Public Sub ClearOutline()
End Sub
Public Sub ColumnDifferences()
End Sub
Public Sub Consolidate()
End Sub
Public Sub ConvertToLinkedDataType()
End Sub
Public Sub Copy()
End Sub
Public Sub CopyFromRecordset()
End Sub
Public Sub CopyPicture()
End Sub
Public Sub CreateNames()
End Sub
Public Sub Cut()
End Sub
Public Function DataSeries (Rowcol, Type, Date, Step, Stop, Trend)
End Function
Public Function DataTypeToText()
End Function
Public Function Delete (Shift)
End Function
Public Function DialogBox()
End Function
Public Function Dirty()
End Function
Public Function DiscardChanges()
End Function
Public Function EditionOptions (Type, Option, Name, Reference, Appearance, ChartSize, Format)
End Function
Public Function ExportAsFixedFormat (Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)
End Function
Public Function FillDown()
End Function
Public Function FillLeft()
End Function
Public Function FillRight()
End Function
Public Function FillUp()
End Function
Public Function Find (What, After, LookIn, LookAt, SearchOrder, SearchDirection, MatchCase, MatchByte, SearchFormat)
End Function
Public Function FindNext (After)
End Function
Public Function FindPrevious (Before)
End Function
Public Function FlashFill ()
End Function
Public Function FunctionWizard ()
End Function
Public Function Group (Start, End, By, Periods)
End Function
Public Function Insert (Shift, CopyOrigin)
End Function
Public Function InsertIndent (InsertAmount)
End Function
Public Function Justify()
End Function
Public Function ListNames()
End Function
Public Function Merge(Across)
End Function
Public Function NavigateArrow(TowardPrecedent, ArrowNumber, LinkNumber)
End Function
Public Function NoteText(Text, Start, Length)
End Function
Public Function Parse(ParseLine, Destination)
End Function
Public Function PasteSpecial(Paste, Operation, SkipBlanks, Transpose)
End Function
Public Function PrintOut(From, To, Copies, Preview, ActivePrinter, PrintToFile, Collate, PrToFileName)
End Function
Public Function PrintPreview(EnableChanges)
End Function
Public Function RemoveDuplicates(Columns , Header)
End Function
Public Function RemoveSubtotal()
End Function
Public Function Replace(What, Replacement, LookAt, SearchOrder, MatchCase, MatchByte, SearchFormat, ReplaceFormat)
End Function
Public Function RowDifferences(Comparison)
End Function
Public Function Run(Arg1, Arg2, Arg3, Arg4, Arg5...)
End Function
Public Function Select()
End Function
Public Function SetCellDataTypeFromCell(Range, LanguageCulture)
End Function
Public Function SetPhonetic()
End Function
Public Function Show()
End Function
Public Function ShowCard()
End Function
Public Function ShowDependents(Remove)
End Function
Public Function ShowErrors()
End Function
Public Function ShowPrecedents(Remove)
End Function
Public Function Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2, DataOption3)
End Function
Public Function SortSpecial(SortMethod, Key1, Order1, Type, Key2, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, DataOption1, DataOption2, DataOption3)
End Function
Public Function Speak(SpeakDirection, SpeakFormulas)
End Function
Public Function SpecialCells(Type, Value)
End Function
Public Function SubscribeTo(Edition, Format)
End Function
Public Function Subtotal(GroupBy, Function, TotalList, Replace, PageBreaks, SummaryBelowData)
End Function
Public Function Table(RowInput, ColumnInput)
End Function
Public Function TextToColumns(Destination, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers
End Function
Public Function Ungroup()
End Function
Public Function UnMerge()
End Function
Public Property AddIndent As Variant
Public Function Address(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo) As Variant
End Function
Public Function AddressLocal(RowAbsolute, ColumnAbsolute, ReferenceStyle, External, RelativeTo) As Range
End Function
Public Property Application As Application
Public Property Areas As Areas
Public Property Borders As Variant
Public Property Cells As Range
Public Function Characters(Start, Length) As Variant
End Function
Public Property Column As Long
Public Property Columns As Long
Public Property ColumnWidth As Variant
Public Property Comment As Variant
Public Property CommentThreaded As Variant
Public Property Count As Long
Public Property CountLarge As Variant
Public Property Creator As Integer
Public Property CurrentArray As Range
'/*
'Returns a Range object that represents the current region.
'The current region is a range bounded by any combination of blank rows and blank columns. Read-only.
'
'Example
'Worksheets("Sheet1").Activate
'ActiveCell.CurrentRegion.Select
'*/
Public Property CurrentRegion As Range
Public Property Dependents As Range
Public Property DirectDependents As Range
Public Property DirectPrecedents As Range
Public Property DisplayFormat As Object
Public Function End(Direction) As Object
End Function
Public Property EntireColumn As Range
Public Property EntireRow As Range
Public Property Errors As Errors
Public Property Font As Font
Public Property FormatConditions As Range
Public Property Formula As Variant
Public Property FormulaArray As Variant
Public Property FormulaHidden As Variant
Public Property FormulaLocal As Object
Public Property FormulaR1C1 As Varaint
Public Property FormulaR1C1Local As Varaint
Public Property HasArray As Varaint
Public Property HasFormula As Varaint
Public Property HasRichDataType As Varaint
Public Property Height As Double
Public Property Hidden As Variant
Public Property HorizontalAlignment As Variant
Public Property Hyperlinks As Object
Public Property ID As String
Public Property IndentLevel As Variant
Public Property Interior As Double
Public Function Item (RowIndex, ColumnIndex) As Range
End Function
Public Property Left As Variant
Public Property LinkedDataTypeState As Variant
Public Property ListHeaderRows As Variant
Public Property ListObject As Object
Public Property LocationInTable As Variant
Public Property Locked As Variant
Public Property MDX As String
Public Property MergeArea As Range
Public Property MergeCells As Boolean
Public Property Name As Variant
Public Property Next As Range
Public Property NumberFormat As Variant
Public Property NumberFormatLocal As Variant
Public Function Offset (RowOffset, ColumnOffset) As Range
End Function
Public Property Orientation As Variant
Public Property OutlineLevel As Variant
Public Property PageBreak As Variant
Public Property Parent As Variant
Public Property Phonetic As Variant
Public Property Phonetics As Variant
Public Property PivotCell As Variant
Public Property PivotField As Variant
Public Property PivotItem As Variant
Public Property PivotTable As Variant
Public Property Precedents As Range
Public Property PrefixCharacter As Variant
Public Property Previous As Range
Public Property QueryTable As Variant
Public Function Range (Cell1, Cell2) As Range
End Function
Public Property ReadingOrder As Variant
Public Function Resize (RowSize, ColumnSize) As Range
End Function
Public Property Row As Long
Public Property RowHeight As Double
Public Property Rows As Range
Public Property ServerActions As Variant
Public Property ShowDetail As Variant
Public Property ShrinkToFit As Variant
Public Property SoundNote As Variant
Public Property SparklineGroups As Variant
Public Property Style As Variant
Public Property Summary As Variant
Public Property Text As String
Public Property Top As Variant
Public Property UseStandardHeight As Variant
Public Property UseStandardWidth As Variant
Public Property Validation As Variant
Public Function Value (RangeValueDataType) As Variant
End Function
Public Property Value2 As Variant
Public Property VerticalAlignment As Variant
Public Property Width As Double
Public Property Worksheet As Worksheet
Public Property WrapText As Variant
Public Property XPath As XPath
End Class

View File

@ -0,0 +1,157 @@
'/*
'Represents a Microsoft Excel workbook.
'
'
'*/
Public Class Workbook()
'/*
'Returns a String that represents the complete path to the
'workbook/file that this workbook object represents.
'
'*/
Public Property Path As String
Public Property Worksheets As Worksheet
'/*
'True if a backup file is created when this file is saved. Read-only Boolean.
'
'@type {Boolean}
'*/
Public Property CreateBackup As Boolean
'/*
'Returns a String value that represents the name of the object.
'
'@type {Boolean}
'*/
Public Property Name As String
'/*
'True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean.
'
'Example:
'If Not ActiveWorkbook.Saved Then
' MsgBox "This workbook contains unsaved changes."
'End If
'
'@type {Boolean}
'*/
Public Property Saved As String
'/*
'Returns a Sheets collection that represents all the sheets in the specified workbook. Read-only Sheets object.
'
'Example:
'Set newSheet = Sheets.Add(Type:=xlWorksheet)
'For i = 1 To Sheets.Count
' newSheet.Cells(i, 1).Value = Sheets(i).Name
' Next i
'
'@type {Sheets}
'*/
Public Property Sheets As Worksheets
'/*
'
'Activates the first window associated with the workbook.
'
'*/
Public Function Activate()
End Function
'/*
'
'Closes the object.
'
'Example
'
'Workbooks("BOOK1.XLS").Close SaveChanges:=False
'
'@param {Variant} SaveChanges:[Optional] True or false
'@param {Variant} FileName:[Optional] Saves changes under this file name.
'@param {Variant} RouteWorkbook:[Optional] True or False
'*/
Public Function Close(SaveChanges,FileName,RouteWorkbook)
End Function
'/*
'Saves changes to the specified workbook.
'*/
Public Function Save()
End Function
'/*
'Saves changes to the workbook in a different file.
'
'@param {Variant} FileName:[Optional]
'@param {Variant} FileFormat:[Optional]
'@param {Variant} Password:[Optional]
'@param {Variant} WriteResPassword:[Optional]
'@param {Variant} ReadOnlyRecommended:[Optional]
'@param {Variant} CreateBackup:[Optional]
'@param {Variant} AccessMode:[Optional]
'@param {Variant} ConflictResolution:[Optional]
'@param {Variant} AddToMru:[Optional]
'@param {Variant} TextCodepage:[Optional]
'@param {Variant} TextVisualLayout:[Optional]
'@param {Variant} Local:[Optional]
'*/
Public Function SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnlyRecommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, TextCodepage, TextVisualLayout, Local)
End Function
'/*
'Exports the data that has been mapped to the specified XML schema map to an XML data file.
'
'@param {String} FileName:[Required]
'@param {XmlMap} Map:[Required]
'*/
Public Function SaveAsXMLData(FileName, Map)
End Function
'/*
'Saves a copy of the workbook to a file but doesn't modify the open workbook in memory.
'
'Example
'ActiveWorkbook.SaveCopyAs "C:\TEMP\XXXX.XLS"
'
'@param {Variant} FileName:[Required]
'*/
Public Function SaveCopyAs(FileName, Map)
End Function
'/*
'Sends the workbook by using the installed mail system.
'
'Example
'ActiveWorkbook.SendMail recipients:="Jean Selva"
'
'@param {Variant} Recipients:[Required]
'@param {Variant} Subject:[Optional]
'@param {Variant} ReturnReceipt:[Optional]
'*/
Public Function SendMail(Recipients, Subject, ReturnReceipt)
End Function
'/*
'
'The ExportAsFixedFormat method is used to publish
'a workbook to either the PDF or XPS format.
'
'*/
Public Function ExportAsFixedFormat(Type, FileName, Quality, IncludeDocProperties, IgnorePrintAreas, From, To, OpenAfterPublish, FixedFormatExtClassPtr)
End Function
End Class

View File

@ -0,0 +1,109 @@
'/*
'A collection of all the Workbook objects that are currently open in the Microsoft Excel application.
'
'*/
Public Class Workbooks()
'/*
'Creates a new workbook. The new workbook becomes the active workbook.
'
'@param {Variant} Template:[Optional] Determines how the new workbook is created.
'If this argument is a string specifying the name of an existing Microsoft Excel file,
'the new workbook is created with the specified file as a template.
'*/
Public Function Add(Template)
End Function
'/*
'True if Microsoft Excel can check out a specified workbook from a server.
'Read/write Boolean.
'
'@param {String} FileName:[Required] The name of the file to check out.
'
'*/
Public Function CanCheckOut (FileName)
End Function
Public Function CheckOut (FileName)
End Function
Public Function Close ()
End Function
'/*
'
'Opens a workbook.
'
'Example
'Workbooks.Open "ANALYSIS.XLS"
'ActiveWorkbook.RunAutoMacros xlAutoOpen
'*/
Public Function Open (FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad) As Workbook
End Function
'/*
'Returns a Workbook object representing a database.
'*/
Public Function OpenDatabase (FileName, CommandText, CommandType, BackgroundQuery, ImportDataAs)
End Function
'/*
'Loads and parses a text file as a new workbook with a single sheet that contains the parsed text-file data.
'*/
Public Function (FileName, Origin, StartRow, DataType, TextQualifier, ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, Other, OtherChar, FieldInfo, TextVisualLayout, DecimalSeparator, ThousandsSeparator, TrailingMinusNumbers, Local)
End Function
'/*
'Opens an XML data file. Returns a Workbook object.
'*/
Public Function OpenXML (FileName, Stylesheets, LoadOption)
End Function
'/*
'When used without an object qualifier, this property returns an
'Application object that represents the Microsoft Excel application.
'
'*/
Public Property Application As Application
'/*
'Returns a Long value that represents the number of objects in the collection.
'
'*/
Public Property Count As Long
'/*
'Returns a 32-bit integer that indicates the application in which this object was created. Read-only Long.
'
'*/
Public Property Creator As Integer
'/*
'Returns a single object from a collection.
'
'*/
Public Property Item(Index) As Object
'/*
'Returns the parent object for the specified object. Read-only.
'
'*/
Public Property Parent As Object
End Class

View File

@ -0,0 +1,86 @@
'/*
'Represents a worksheet.
'
'Example
'
'Worksheets(1).Visible = False
'
'*/
Public Class Worksheet()
'/*
'Makes the current sheet the active sheet.
'
'Example
'ActiveWorkbook.SendMail recipients:="Jean Selva"
'*/
Public Sub Activate()
End Sub
Public Sub Calculate()
End Sub
Public Sub Copy()
End Sub
Public Sub Delete()
End Sub
Public Sub Move()
End Sub
Public Sub Past()
End Sub
Public Sub PastSpecial()
End Sub
Public Sub Select()
End Sub
Public Sub SaveAs()
End Sub
'/*
'
'Returns a Range object that represents a cell or a range of cells.
'
'Example:
'
'Worksheets("Sheet1").Range("A1").Value = 3.14159
'
'*/
Public Property Range As Range
'/*
'
'Returns a Range object that represents all the rows on the specified worksheet.
'
'Example:
'
'Worksheets("Sheet1").Rows(3).Delete
'
'*/
Public Property Row As Range
'/*
'
'Returns a Long value that represents the index number of the
'object within the collection of similar objects.orksheets("Sheet1").Rows(3).Delete
'
'*/
Public Property Index As Long
End Class

View File

@ -0,0 +1,54 @@
'/*
'A collection of all the Worksheet objects in the specified or active workbook. Each Worksheet object represents a worksheet.
'
'Example
'
'Worksheets(1).Visible = False
'
'*/
Public Class Worksheets()
'/*
'Constructor
'
'*/
Public Sub New(Name As String) As Worksheet
End Sub
Public Sub Add()
End Sub
Public Sub Add2()
End Sub
Public Sub Copy()
End Sub
Public Sub Delete()
End Sub
Public Sub Move()
End Sub
Public Sub FillAcrossSheets()
End Sub
Public Sub PrintOut()
End Sub
Public Sub PrintPreview()
End Sub
Public Sub Select()
End Sub
End Class

View File

@ -0,0 +1,15 @@
{
"package": "excel-types",
"version": "1.0.0",
"author": "Alberto Oliveira",
"email": "alberto.aeraph@gmail.comn",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/Aeraphe/excel-types.git"
},
"description": "Creating amazing XVBA packages",
"dependencies": {},
"dev_dependencies": {},
"homepage": "https://github.com/Aeraphe/xvba-cli"
}