慢慢完善起来,调试与测试并重,请进一步测试。(撇开画布,如无有异常,则转入下一步工作,实际上如果成功,只是加入几句代码) 这是新增的部分代码,另外的,请详看附件。 '* +++++++++++++++++++++++++++++ '* Created By SHOUROU@ExcelHome 2006-8-14 6:21:44 '仅测试于System: Windows NT Word: 11.0 Language: 2052 '№ 0055^The Code CopyIn [ThisDocument-ThisDocument]^' '* ----------------------------- Sub SetDrawingDefaults() '修改Word命令,此代码用于右键中的设置自选图形默认效果 '该代码基于将当前所选图形格式应于Mydoc中并储存起来.然后将myDoc中的指定图形格式 '应用于本文档中,再设置为默认格式 On Error Resume Next Dim myShape As Shape, shType As MsoShapeType Dim AutoType As MsoAutoShapeType myDoc.Shapes("mySetShapeDefault").Delete With Selection.ShapeRange(1) shType = .Type .SetShapesDefaultProperties .PickUp Select Case shType Case msoAutoShape AutoType = .AutoShapeType Select Case AutoType Case msoShapeFlowchartAlternateProcess Set myShape = myDoc.Shapes.AddShape(msoShapeFlowchartAlternateProcess, 0, 0, 0, 0) Case msoShapeFlowchartProcess Set myShape = myDoc.Shapes.AddShape(msoShapeFlowchartProcess, 0, 0, 0, 0) Case msoShapeMixed Set myShape = myDoc.Shapes.AddShape(msoShapeRectangle, 0, 0, 0, 0) Case msoShapeOval Set myShape = myDoc.Shapes.AddShape(msoShapeOval, 0, 0, 0, 0) Case Else Set myShape = myDoc.Shapes.AddShape(msoShapeRectangle, 0, 0, 0, 0) End Select Case msoLine Set myShape = myDoc.Shapes.AddLine(0, 0, 0, 0) Case msoTextBox Set myShape = myDoc.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 0, 0, 0) End Select myShape.Name = "mySetShapeDefault" myShape.Apply End With End Sub '---------------------- Sub ShowDialogbywdDialogFormatDrawingObject() Dim myDialog As Dialog, N As String N = Word.CommandBars.ActionControl.Caption Set myDialog = Word.Dialogs(wdDialogFormatDrawingObject) With myDialog Select Case N Case "线条与颜色" .DefaultTab = 1200000 Case "大小" .DefaultTab = 1200001 Case "版式" .DefaultTab = 1200002 Case "文本框" .DefaultTab = 1200005 End Select .Show End With End Sub
j6SJpbpz.rar
(34.2 KB, 下载次数: 28)
[此贴子已经被作者于2006-8-14 6:24:43编辑过] |