ゆっくり開発

思いついた便利コードを気ままにアップしていきます。公開しているソースコードはすべてMITライセンスです。

2021-09-01から1ヶ月間の記事一覧

【VBA】参照設定の追加

Private Const 参照設定VBA As String = "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.DLL" Private Const 参照設定Excel As String = "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE" Private Const 参照設定OLE As Str…

【VBA】先頭文字列追加 末尾文字列追加

Function 先頭文字列追加( _ ByRef 対象文字列 As String _ , ByRef 先頭文字列 As String _ , Optional ByRef 既にあれば追加しない As Boolean = True _ ) As String If 既にあれば追加しない Then 先頭文字列追加 = IIf(対象文字列 Like "*" & 先頭文字列…

【VBA】別ファイルのシートコピー

Function 別ブックのシート取込( _ ByRef 対象ファイルのパス As String _ , ByRef 対象シート一覧 As Variant _ , Optional ByRef シートを表示する As Variant = xlSheetVisible _ ) On Error GoTo ■エラー処理 Dim ファイルシステム As Object Dim シート…

【VBA】2つのシートを結合して検索するSQL

■関連情報 - 【VBA】別ファイルのシートコピー DB関連モジュール Option Explicit Private Const DBプロバイダ As String = "Microsoft.ACE.OLEDB.12.0" Private Const DBプロパティ As String = "Extended Properties" Private Const DBExcelバージョン As …

notionから記事はコチラ

notionの記事公開です https://astonishing-wandflower-0b6.notion.site/notion-f4d167700caa43469cb98f4da148becc

【VBA】設定一覧シートから設定情報を取得する

設定シートイメージ 構成イメージ 設定の取得コード Property Get val(ByRef ParamName As String) As String Dim L As ListObject For Each L In shSetting.ListObjects If L.Name = "設定一覧" Then val = Cells(L.ListColumns("設定値").Range.Column, _ …

【VBA】方眼紙解析 項目範囲特定

'####################################### '方眼フォーマット 項目範囲取得 '####################################### Sub GetFieldArea() On Error GoTo Catch Dim i As Integer Dim j As Integer Dim rng As Range Dim strMergeArea As String Dim CN As…

【VBA】正規表現 置き換え

'####################################### '正規表現置換 '【概要】 ' 正規表現で文字列置換する '【参照設定】 ' Microsoft VBScript Regular Expressions 5.5 '【引数】 ' 対象文字列 :変更前文字列 ' パターン :検索条件 ' 置き換え文字列 :置き換え…