我需要通过VBA代码在记事本中自动调用“saveas”,并选择“encoding”“saveastype”
我可以获得hWnd
“Saveas”,但不知道如何获取“编码”组合框的hWnd
。
“保存类型”comboBoxo的hWnd
。
Private Sub Command1_Click()
Dim hWnd As Long, hMenu As Long, MenuID As Long
hWnd = FindWindow(vbNullString, "test.txt - Notepad")
If hWnd > 0 Then
hMenu = GetMenu(hWnd)
hMenu = GetSubMenu(hMenu, 0)
MenuID = GetMenuItemID(hMenu, 3)
SendMessage hWnd, WM_COMMAND, MenuID, 0&
SaveAs = FindWindow(vbNullString, "Save As")
FileNameComboBox = FindWindowEx(ImportBox, 0, "ComboBox", vbNullString)
SendMessage FileNameComboBox, CB_SHOWDROPDOWN, 4, 0
End If
End Sub
在上面的代码中,FileNameComboBox
是“编码”的hWnd
,我不确定
如何获得“另存为类型”组合框