On Error GoTo errhandler               
转到错误处理, 在exit sub后肯定还有一行为 errhandler:
就是转到该行以后的语句执行.CommonDialog1.Flags = cdlCCRGBInit    
这个可以在对象浏览器里面查到......

解决方案 »

  1.   

    1、将Flags属性设置为cdlCCRGBInit,则CommonDialog就会把Color属性作为初始值。 
        With CommonDialog1
            .Color = vbRed
            '.Flags = cdlCCRGBInit//如果把这句话注释掉,那么颜色框的初始值为黑色,不注释则为红色。
            .ShowColor
        End With
    2、在Exit Sub前加    
        errhandler:
      

  2.   

    On Error GoTo errhandler
    '错误捕获语句,当发生错误时执行errhandler后面的代码CommonDialog1.Flags = cdlCCRGBInit
    '颜色对话框的Flags属性,含义是“为自定义颜色对话框设置初始颜色”。