operating_systems:microsoft:vsreplace
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
operating_systems:microsoft:vsreplace [2013/05/14 15:16] – created sbolay | operating_systems:microsoft:vsreplace [2013/05/14 15:29] (current) – sbolay | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== VSReplace ====== | ====== VSReplace ====== | ||
- | < | + | < |
Attribute VB_Name = " | Attribute VB_Name = " | ||
' | ' | ||
Line 7: | Line 7: | ||
'Last update: may 14, 2013 | 'Last update: may 14, 2013 | ||
+ | ' | ||
Public Sub VSReplace() | Public Sub VSReplace() | ||
Dim Directory As String | Dim Directory As String | ||
Dim FType As String | Dim FType As String | ||
Dim FName As String | Dim FName As String | ||
+ | | ||
+ | FType = " | ||
+ | FLocation = " | ||
| | ||
Dim colFiles As New Collection | Dim colFiles As New Collection | ||
- | RecursiveDir colFiles, | + | RecursiveDir colFiles, |
- | + | ||
- | FType = " | + | |
Dim vFile As Variant | Dim vFile As Variant | ||
Line 33: | Line 34: | ||
End Sub | End Sub | ||
+ | 'From http:// | ||
Public Function RecursiveDir(colFiles As Collection, _ | Public Function RecursiveDir(colFiles As Collection, _ | ||
| | ||
Line 70: | Line 72: | ||
End Function | End Function | ||
+ | 'From http:// | ||
Public Function TrailingSlash(strFolder As String) As String | Public Function TrailingSlash(strFolder As String) As String | ||
If Len(strFolder) > 0 Then | If Len(strFolder) > 0 Then | ||
Line 80: | Line 83: | ||
End Function | End Function | ||
+ | ' | ||
Public Function FindAndReplace() | Public Function FindAndReplace() | ||
Dim myStoryRange As Range | Dim myStoryRange As Range | ||
+ | |||
+ | TFind_FR = " | ||
+ | TReplace_FR = " | ||
+ | |||
+ | TFind_DE = " | ||
+ | TReplace_DE = " | ||
'First search the main document using the Selection and replace french text | 'First search the main document using the Selection and replace french text | ||
With Selection.Find | With Selection.Find | ||
- | .Text = " | + | .Text = TFind_FR |
- | .Replacement.Text = " | + | .Replacement.Text = TReplace_FR |
.Forward = True | .Forward = True | ||
.Wrap = wdFindContinue | .Wrap = wdFindContinue | ||
Line 101: | Line 111: | ||
' | ' | ||
With Selection.Find | With Selection.Find | ||
- | .Text = " | + | .Text = TFind_DE |
- | .Replacement.Text = " | + | .Replacement.Text = TReplace_DE |
.Forward = True | .Forward = True | ||
.Wrap = wdFindContinue | .Wrap = wdFindContinue | ||
Line 118: | Line 128: | ||
If myStoryRange.StoryType <> wdMainTextStory Then | If myStoryRange.StoryType <> wdMainTextStory Then | ||
With myStoryRange.Find | With myStoryRange.Find | ||
- | .Text = " | + | .Text = TFind_FR |
- | .Replacement.Text = " | + | .Replacement.Text = TReplace_FR |
.Wrap = wdFindContinue | .Wrap = wdFindContinue | ||
.Execute Replace: | .Execute Replace: | ||
End With | End With | ||
With myStoryRange.Find | With myStoryRange.Find | ||
- | .Text = " | + | .Text = TFind_DE |
- | .Replacement.Text = " | + | .Replacement.Text = TReplace_DE |
.Wrap = wdFindContinue | .Wrap = wdFindContinue | ||
.Execute Replace: | .Execute Replace: | ||
Line 132: | Line 142: | ||
Set myStoryRange = myStoryRange.NextStoryRange | Set myStoryRange = myStoryRange.NextStoryRange | ||
With myStoryRange.Find | With myStoryRange.Find | ||
- | .Text = " | + | .Text = TFind_FR |
- | .Replacement.Text = " | + | .Replacement.Text = TReplace_FR |
.Wrap = wdFindContinue | .Wrap = wdFindContinue | ||
.Execute Replace: | .Execute Replace: | ||
End With | End With | ||
With myStoryRange.Find | With myStoryRange.Find | ||
- | .Text = " | + | .Text = TFind_DE |
- | .Replacement.Text = " | + | .Replacement.Text = TReplace_DE |
.Wrap = wdFindContinue | .Wrap = wdFindContinue | ||
.Execute Replace: | .Execute Replace: |
operating_systems/microsoft/vsreplace.1368544565.txt.gz · Last modified: 2013/05/14 15:16 by sbolay