社区
oDoc = ThisDoc.Document Dim oT As String Dim nT As String Dim oSl As New ArrayList oSl.Add("通用注释")'通用注释 oSl.Add("孔标注")'孔标注 oSl.Add("倒角标注")'倒角标注 oSl.Add("指引导线文本")'指引导线文本 oSl.Add("通用尺寸")'通用尺寸 oSl.Add("视图草图里文本")'视图草图里文本 oSl.Add("自由草图里文本")'自由草图里文本 oSl.Add("所有项目")'所有项目 '输入 oT = InputBox("请输入需要替换的文本:", "iLogic - 批量替换文本 - Frank Li", "XXX") '输入为空,则退出 If oT ="" Then Exit Sub nT = InputBox("请输入新文本,用来替换: "& oT & " ", "iLogic - 批量替换文本 - Frank Li", "****") '选择某个项目或全部 S = InputListBox("请选择需要进行文本替换的项目!", oSl, "所有项目", Title := "选择替换项目", ListName := "项目列表") For Each oSheet As Sheet In oDoc.Sheets Select Case S Case "通用注释" For Each oGn As GeneralNote In oSheet.DrawingNotes.GeneralNotes oGn.FormattedText = oGn.FormattedText.Replace(oT,nT) Next Case "孔标注" For Each oHn As HoleThreadNote In oSheet.DrawingNotes.HoleThreadNotes oHn.FormattedHoleThreadNote = oHn.FormattedHoleThreadNote.Replace(oT,nT) Next Case "倒角标注" For Each oCn As ChamferNote In oSheet.DrawingNotes.ChamferNotes oCn.FormattedChamferNote = oCn.FormattedChamferNote.Replace(oT,nT) Next Case "指引导线文本" For Each oLn As LeaderNote In oSheet.DrawingNotes.LeaderNotes oLn.FormattedText = oLn.FormattedText.Replace(oT,nT) Next Case "通用尺寸" For Each oDd As DrawingDimension In oSheet.DrawingDimensions oDd.Text.FormattedText = oDd.Text.FormattedText.Replace(oT,nT) Next Case "视图草图里文本" For Each oDv As DrawingView In oSheet.DrawingViews For Each oDs As DrawingSketch In oDv.Sketches oDs.Edit For Each oDst As TextBox In oDs.TextBoxes oDst.FormattedText = oDst.FormattedText.Replace(oT, nT) Next oDs.ExitEdit Next Next Case "自由草图里文本" For Each oS As DrawingSketch In oSheet.Sketches oS.Edit For Each oSt As TextBox In oS.TextBoxes oSt.FormattedText = oSt.FormattedText.Replace(oT, nT) Next oS.ExitEdit Next Case "所有项目" For Each oGn As GeneralNote In oSheet.DrawingNotes.GeneralNotes oGn.FormattedText = oGn.FormattedText.Replace(oT,nT) Next For Each oHn As HoleThreadNote In oSheet.DrawingNotes.HoleThreadNotes oHn.FormattedHoleThreadNote = oHn.FormattedHoleThreadNote.Replace(oT,nT) Next For Each oCn As ChamferNote In oSheet.DrawingNotes.ChamferNotes oCn.FormattedChamferNote = oCn.FormattedChamferNote.Replace(oT,nT) Next For Each oLn As LeaderNote In oSheet.DrawingNotes.LeaderNotes oLn.FormattedText = oLn.FormattedText.Replace(oT,nT) Next For Each oDd As DrawingDimension In oSheet.DrawingDimensions oDd.Text.FormattedText = oDd.Text.FormattedText.Replace(oT,nT) Next For Each oDv As DrawingView In oSheet.DrawingViews For Each oDs As DrawingSketch In oDv.Sketches oDs.Edit For Each oDst As TextBox In oDs.TextBoxes oDst.FormattedText = oDst.FormattedText.Replace(oT, nT) Next oDs.ExitEdit Next Next For Each oS As DrawingSketch In oSheet.Sketches oS.Edit For Each oSt As TextBox In oS.TextBoxes oSt.FormattedText = oSt.FormattedText.Replace(oT, nT) Next oS.ExitEdit Next End Select Next
您是在分享程序还是有什么疑问? 为了更好的大家帮助大家, 能否上源程序文本,而不是截屏呢。