tomek123
Bywalec tomek123
Wersja CorelDRAW: X7
Pomógł: 8 razy Dołączył: 06 Gru 2014 Posty: 34 Skąd: Tychy
|
Wysłany: 3 Maj 2015, 15:34
|
|
|
Zmienia we wszystkich otwartych dokumentach 'szukany tekst' na 'nowy tekst'
Kod: |
Public Sub Replace_Text_To_All_Doc()
Dim strTxt1 As String, strTxt2 As String
Optimization = True
strTxt1 = InputBox("Wpisz szukany tekst: ", "FIND (stary tekst)")
strTxt2 = InputBox("Wpisz nowy tekst: ", "REPLACE (nowy tekst)")
Dim doc As Document
For Each doc In Documents
Replace_Text doc, strTxt1, strTxt2
Next
Optimization = False
End Sub
Private Function Replace_Text(doc As Document, strTxt1 As String, strTxt2 As String)
Dim s As Shape, sr As ShapeRange, _
strTxtActual As String, strTxtChange As String
Set sr = doc.ActiveLayer.Shapes.FindShapes(, cdrTextShape, True)
For Each s In sr
strTxtActual = s.Text.Story.Text
If Len(Replace(strTxtActual, strTxt1, "", , , vbTextCompare)) <> Len(strTxtActual) Then
strTxtChange = Replace(strTxtActual, strTxt1, strTxt2, , , vbTextCompare)
s.Text.Story.Text = strTxtChange
End If
Next
End Function
|
|
|