- Private Sub ss1()
- Dim x As New ZZYCommonDialog
- Dim bC As Boolean, lFSC As Long, strF() As String, sLD As String
- x.ShowOpen ThisDrawing.Application.HWND32, bC, lFSC, strF, sLD'ThisDrawing.Application.HWND32,如果出错,用0代替
- Debug.Print bC
- If Not bC Then
- Debug.Print lFSC
- Debug.Print strF(0)
- Debug.Print sLD
- End If
- Set x = Nothing
- End Sub
- Private Sub ss2()
- Dim x As New ZZYCommonDialog
- Dim bC As Boolean, oC As OLE_COLOR
- x.ShowColor ThisDrawing.Application.HWND32, bC, oC
- Debug.Print bC
- Debug.Print oC
- Set x = Nothing
- End Sub
- Private Sub ss3()
- Dim x As New ZZYCommonDialog
- Dim Canceled As Boolean, SelectedFont As String, Bold As Boolean, Italic As Boolean, Size As Integer, Underline As Boolean, StrikeOut As Boolean, Color As Long, FaceName As String
- x.ShowFont ThisDrawing.Application.HWND32, Canceled, SelectedFont, Bold, Italic, Size, Underline, StrikeOut, Color, FaceName
- Debug.Print Canceled, SelectedFont, Bold, Italic, Size, Underline, StrikeOut, Color, FaceName
- Set x = Nothing
- End Sub
- Private Sub ss4()
- Dim x As New ZZYCommonDialog
- Dim bC As Boolean, lFSC As Long, strF As String, sLD As String
- x.ShowSave ThisDrawing.Application.HWND32, bC, lFSC, strF, sLD
- Debug.Print bC
- Debug.Print lFSC
- Debug.Print strF
- Debug.Print sLD
- Set x = Nothing
- End Sub
再然后,点击VBA编辑器的菜单,“”-》“引用”,
2flyyvsobaw.jpg
出来以下对话框,再点“浏览”,然后出现如下对话框 ,找到刚才你解压的附件的文件夹,选择那个文件“ZZYCommonDialogForVBAx64.exe”(扩展名是exe,不要害怕,是activex exe,Word,excel也是这样的程序)
jbq41vl2ehm.jpg
点“打开”,点“确定”。
mrarephvceo.jpg
如果没有任何提示,恭喜你,你引用成功了,接下来,按F5运行哪几个测试代码就行了,
其中ss1是测试“打开”对话框的,ss2是测试“选择颜色”对话框的,其它自己试吧!
有人试用了,说不支持过滤文件扩展名,所以增加一下这个功能,出个升级版,同时,原版免币!------------------
2018-06-16更新一下,支持选择多个文件,