投稿

5月, 2022の投稿を表示しています

連想配列でルックアップな方法 背景色を抽出

Quick Edit Pencil


Sub aaa()

'***** 部門.マスター *****

    Dim 部門辞書 As Object
    Set 部門辞書 = CreateObject("Scripting.Dictionary")
    
    For Each セル In range("B2:G2") 'range("部門識別子")
        部門辞書.Add セル.Value, セル.Interior.Color
    Next
    
    Debug.Print 部門識別カラー("HO")

End Sub

エクセル セル選択範囲 複数

Quick Edit Pencil
Union(range("選択範囲1"), range("選択範囲2")).Select

range("選択範囲1,選択範囲2").Select

VBA 選択範囲の任意の列のRange(R1C1)を取得

Quick Edit Pencil
Debug.Print ConvertToLetter(Selection.Column) & Selection.Row & ":" & _ConvertToLetter(Selection.Column) & Selection.Rows(Selection.Rows.Count).Row
        
Debug.Print Range(Cells(Selection.Row, 2), Cells(Selection.Rows(Selection.Rows.Count).Row, 2)).Address
        
Debug.Print Selection.Columns(2).Address

excel入力規則メモ

Quick Edit Pencil
B15 =大分類コード

C15 =INDIRECT(LOOKUP($B15,大・中分類一覧!$4:$4,大・中分類一覧!$2:$2))



WindowDOM vba html

Quick Edit Pencil
リンク
WindowDOM vba html - 検索

vba FindWindow

Quick Edit Pencil

ウインドウ一覧のクラス名とキャプション名を取得する()




WindowsAPIを用いてウインドウの一覧表を作成するVBAコード | VBA・GAS・Pythonで仕事を楽しく効率化
vba FindWindow - 検索
'ウインドウハンドルを取得する
Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long

'ウインドウが可視かどうかを取得する
Declare Function IsWindowVisible Lib "user32" _
(ByVal hWnd As Long) As Long

'ウインドウのキャプションタイトルを取得する
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
(ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long

'ウインドウのクラス名を取得する
Declare Function GetClassName Lib "user32" Alias "GetClassNameA" _
(ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long

'取得中のウインドウの次または前のウインドウハンドルを取得する
Declare Function GetNextWindow Lib "user32" Alias "GetWindow" _
(ByVal hWnd As Long, ByVal wFlag As Long) As Long

Const GW_HWNDLAST = 1
Const GW_HWNDNEXT = 2

Sub ウインドウ一覧のクラス名とキャプション名を取得する()

Dim i As Long
i = 1

Dim strClassName As String * 100
Dim strCaption As String * 80

Dim hWnd As Long
hWnd = FindWindow(vbNullString, vbNullString) '引数を両方ともvbNullStringにして1つめのウインドウを取得する

Do
If IsWindowVisible(hWnd) Then
GetWindowText hWnd, strCaption, Len(strCaption)
GetClassName hWnd, strClassName, Len(strClassName)

Cells(i, 1).Value = strClassName
Cells(i, 2).Value = strCaption

'Cells(i, 1).Value = Left(strClassName, InStr(strClassName, vbNullChar) ? 1)
'Cells(i, 2).Value = Left(strCaption, InStr(strCaption, vbNullChar) ? 1)

i = Application.WorksheetFunction.Max(Cells(60000, 1).End(xlUp).Row, Cells(60000, 2).End(xlUp).Row, Cells(60000, 3).End(xlUp).Row) + 1

End If

hWnd = GetNextWindow(hWnd, GW_HWNDNEXT)

Loop Until hWnd = GetNextWindow(hWnd, GW_HWNDLAST)

End Sub

VBAでWindowsAPIを用いてウインドウを取得する手順について | VBA・GAS・Pythonで仕事を楽しく効率化