read TOC(Table of Content), reformat TOC hierarchy and write the result into a text file

J

john smith

Hi,

I'd like to read the TOC starting from below "Part II test cases" until the
end of TOC. After that, I need reformat the TOC hierarchy in the format like
below and finally write the result to a text file.

Example:

TOC in Ms Word
Part II Test Cases 7

1 Schedule Document 7

1.1 Cleanup instance after scheduling. 7

1.2 WebI Specific Scheduling. 8

1.3 Document Format 9

2 Schedule to printer 9

2.1 Collate option for Crystal Report 9

3 Default Destination. 11

3.1 Alter the object destination to default destination. 11

3.2 Schedule to Default Destination. 12







Text file format:

1=/Schedule Document

2=/Schedule Document/Cleanup instance after scheduling

3=/Schedule Document/WebI Specific Scheduling

4=/Schedule Document/Document Format

5=/Schedule to printer

6=/Schedule to printer/Collate option for Crystal Report

7=/Default Destination

8=/Default Destination/Alter the object destination to default destination

9=/Default Destination/Schedule to Default Destination





Please help me!

Thank you so much. Any helps will be greatly appreciated.



Regards,

John
 
R

Russ

John,
Hi,

I'd like to read the TOC starting from below "Part II test cases" until the
end of TOC.

See these messages for sending original TOC to a file.
http://tinyurl.com/q8jqc

After that, I need reformat the TOC hierarchy in the format like
below and finally write the result to a text file.

Bring the TOC text file back into Word and run the code below to format it.
You should be able to combine the two procedures into one, if you want.
Example:

TOC in Ms Word
Part II Test Cases 7

1 Schedule Document 7

1.1 Cleanup instance after scheduling. 7

1.2 WebI Specific Scheduling. 8

1.3 Document Format 9

2 Schedule to printer 9

2.1 Collate option for Crystal Report 9

3 Default Destination. 11

3.1 Alter the object destination to default destination. 11

3.2 Schedule to Default Destination. 12







Text file format:

1=/Schedule Document

2=/Schedule Document/Cleanup instance after scheduling

3=/Schedule Document/WebI Specific Scheduling

4=/Schedule Document/Document Format

5=/Schedule to printer

6=/Schedule to printer/Collate option for Crystal Report

7=/Default Destination

8=/Default Destination/Alter the object destination to default destination

9=/Default Destination/Schedule to Default Destination





Please help me!

Thank you so much. Any helps will be greatly appreciated.



Regards,

John
Public Sub Alter_TOC()
Dim oParagraph As Word.Paragraph
Dim aRange As Range
Dim aRange2 As Range
Dim aRange3 As Range
Dim aLong As Long
Set aRange = ActiveDocument.Range(0, 0)
ActiveDocument.Paragraphs(1).Range.Delete

With aRange.Find
.Text = " {1,}[0-9]{1,}^13 ^13 {1,}[0-9]{1,}.[0-9]{1,} {1,}"
.Replacement.Text = "/"
.MatchWildcards = True
.Execute replace:=wdReplaceAll
.Text = " {1,}[0-9]{1,} {1,}"
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = " {1,}[0-9]{1,}"
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = "^13 {1,}^13"
.Replacement.Text = "^p^p"
.Execute replace:=wdReplaceAll
.Text = "."
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = "/"
.Replacement.Text = "^&"
While .Execute
Set aRange2 = aRange.Duplicate
Set aRange3 = aRange.Duplicate
aRange3.Expand unit:=wdParagraph
aRange2.MoveStartUntil cset:=Chr(13), Count:=wdBackward
aRange2.MoveEnd unit:=wdCharacter, Count:=-1
With aRange3.Find
.Text = "/"
.Replacement.Text = "^p^p" & aRange2.Text & "/"
.Execute replace:=wdReplaceAll
End With
aRange.SetRange Start:=aRange3.End, End:=ActiveDocument.Content.End
Wend
End With
ActiveDocument.Paragraphs(1).Range.Delete
aLong = 1

For Each oParagraph In ActiveDocument.Paragraphs
If oParagraph.Range.Characters.Count > 1 Then
oParagraph.Range.InsertBefore aLong & "=/"
aLong = aLong + 1
End If
Next oParagraph

End Sub
 
J

john smith

Hi Russ,

Thanks for trying but the code didn't work. It only deleting the dot on the
section number for TOC but didn't replacing it again with =/. Thus I need to
hit CTRL+C to stop your code from looping forever.

Please use this page to try your code:
Table Of Contents



Part I Background Information. 7

1 Overview of Feature or System under Test 7

2 Scope of Test 7

3 Assumptions and Constraints 7

3.1 General 8

3.2 Report Database. 8

3.3 3rd party authentication. 8

3.4 Events 8

3.5 What is supported for specific previous versions 8

3.5.1 CE8.5. 8

3.5.2 CE9.0. 8

3.5.3 CE10. 8

3.5.4 BOE11. 9

3.5.5 BOE11.5. 9

4 Resources Requirements 9

4.1 Skill Requirements 9

4.2 Software Requirements 10

4.3 Hardware Requirements 10

5 Test Environment Configuration. 10

5.1 Operation defaults 10

5.2 Create group hierarchy. 10

5.3 User/Group/Folder rights Model 11

5.4 Add and setup BCAP related objects 11

5.5 Add multiple reports and related encyclopedia objects 12

5.6 Import Users and User Groups from Profiles 12

6 Validation Method. 13

6.1 Object properties is set correctly in the destination system. 13

6.2 Importing object from BIAR file pre-condition. 13

6.3 The BCAP specific relation and reference properties are retained. 13

6.4 Large dataset 15

7 Platform Applicable. 15

8 Reference Documents 15

9 Organization of Test Cases 15

Part II Test Cases 16

1 Object Integrity. 16

1.1 User 16

1.2 Group. 16

1.3 Event 17

1.4 Calendar 18

1.5 Folder 18

1.6 Report 19

1.7 Program Object 20

1.8 3rd Party Document 20

1.9 WebI 21

1.10 Hyperlink 22

1.11 Dashboard Page. 22

1.12 Object Package. 23

1.13 OLAP Reports 23

1.14 Scheduling Info for schedulable objects 25

1.14.1 Notification. 25

1.14.2 Destination. 27

1.14.3 Schedule For 30

1.14.4 Report Alert Notification. 31

1.14.5 Format 32

1.14.6 Scheduling and instances 34

1.14.7 Time Zone. 36

2 Object Dependencies 37

2.1 User and User Group. 37

2.1.1 Enterprise User, User Group and Subgroup. 37

2.1.2 3rd Party Authentication Group and User 42

2.1.3 User and his/her Favorites Folder, Inbox and Personal Category. 45

2.1.4 Server group, subgroup and server 46

2.1.5 Viewing/Scheduling with prefered/specified server group. 48

2.1.6 Scheduling with Event 49

2.1.7 Scheduling with Calendar 53

2.1.8 Category and Document 54

2.1.9 Folder and Object Hierarchy. 56

2.1.10 Shortcut and InfoObject it refers to. 57

2.1.11 WebI Document, Universe, Connection. 58

2.1.12 Universe and Connection. 59

2.1.13 Universe, Overload and User 59

2.1.14 Universe and Report 60

2.1.15 Universe and Core-Universe. 61

2.1.16 InfoObject and Discussion. 62

2.1.17 Report and report repository. 63

2.1.18 Report and Processing Extension. 64

2.1.19 Report and Metadata. 65

2.1.20 Report and Dynamic Cascading Parameters 67

2.1.21 BCAP (Publications, Documents, Profiles, Principals, Universes) 68

2.1.22 Document and Encyclopedia Objects 68

2.1.23 Process Tracker Objects 71

3 Export InfoObject to BIAR file. 72

3.1 Object Integrity. 72

3.1.1 User 72

3.1.2 Group. 72

3.1.3 Event 73

3.1.4 Calendar 73

3.1.5 Folder 74

3.1.6 Report 74

3.1.7 Program. 75

3.1.8 3rd Party Document 75

3.1.9 Hyperlink 76

3.1.10 Object Package. 76

3.1.11 OLAP Report 77

3.1.12 Scheduling Info for Schedulable Objects 77

3.1.12.1 Notification. 77

3.1.12.2 Destination. 78

3.1.12.3 Schedule For 79

3.1.12.4 Report Alert Nofification. 80

3.1.12.5 Format 80

3.1.12.6 Scheduling and instances 81

3.2 Object Dependencies 83

3.2.1 User and User Group. 83

3.2.1.1 Enterprise User, User Group and Subgroup. 83

3.2.1.2 3rd Party Authentication Group and User 84

3.2.2 User and his/her Favorites Folder, Inbox and Personal Category. 84

3.2.3 Server group, subgroup and server 85

3.2.4 Viewing/Scheduling with prefered/specified server group. 85

3.2.5 Scheduling with event 86

3.2.6 Category and Document 86

3.2.7 Folder and Object Hierarchy. 87

3.2.8 Shortcut and InfoObject it refers to. 88

3.2.9 InfoObject and Discussion. 88

3.2.10 Report and Report Repository. 89

3.2.11 Report and Processing Extension. 89

3.2.12 Report and Metadata. 89

3.2.13 Report and Dynamic Cascading Parameter 90

3.2.14 BCAP (Publications, Documents, Profiles, Principals, Universes) 91

3.2.15 Document and Encyclopedia Objects 91

3.2.16 Calendar and Report 91

3.2.17 Process Tracker Objects 92

4 Import Rights and Limits Settings 92

4.1 User and Group Rights 92

4.2 Instance Limits for folder and schedulable object 96

5 Importing Scenarios 98

5.1 Merge source system into destination system. 98

5.2 Update destination system using source system as a reference. 101

5.3 Incremental Importing. 103

5.4 Licensing. 103

6 Source and destination CMS selection and logon. 103

6.1 Logging on to source CMS. 103

6.2 Logging on to destination CMS. 104

6.3 Logging on CMS as non-administrator 105

7 Tree control and object displaying. 105

8 Resilience to error conditions 106

8.1 File Server is down. 106

8.2 BIAR file is invalid. 107

9 Importing of large dataset 107

10 Import Users and Profiles 108

10.1 Import file handling. 108

10.1.1 File Format 108

10.1.2 File Size/Type. 110

10.2 Object Creation/Updating. 113

10.2.1 Create Users/Groups/Profiles/Database Credentials 113

10.2.1.1 Users 113

10.2.1.2 Groups 115

10.2.1.3 Profiles 117

10.2.1.4 Database Credentials 118

10.2.2 Update Users/Groups/Profiles/Database Credentials 121

10.2.2.1 Users 121

10.2.2.2 Groups 123

10.2.2.3 Profiles 124

10.2.2.4 Database Credentials 125

10.2.3 Group Membership. 126

10.2.3.1 Add Users to group if not member 126

10.2.3.2 Remove users from group if not included. 127

10.3 User Interface. 128

10.3.1 Dialog flow. 128

10.3.2 Dialog Validation. 129

10.3.3 Specify Source Environment 130

10.3.4 Select options for file import 130

10.3.5 Preview results from file import 131



Thanks,
John

Russ said:
John,
Hi,

I'd like to read the TOC starting from below "Part II test cases" until
the
end of TOC.

See these messages for sending original TOC to a file.
http://tinyurl.com/q8jqc

After that, I need reformat the TOC hierarchy in the format like
below and finally write the result to a text file.

Bring the TOC text file back into Word and run the code below to format
it.
You should be able to combine the two procedures into one, if you want.
Example:

TOC in Ms Word
Part II Test Cases 7

1 Schedule Document 7

1.1 Cleanup instance after scheduling. 7

1.2 WebI Specific Scheduling. 8

1.3 Document Format 9

2 Schedule to printer 9

2.1 Collate option for Crystal Report 9

3 Default Destination. 11

3.1 Alter the object destination to default destination. 11

3.2 Schedule to Default Destination. 12







Text file format:

1=/Schedule Document

2=/Schedule Document/Cleanup instance after scheduling

3=/Schedule Document/WebI Specific Scheduling

4=/Schedule Document/Document Format

5=/Schedule to printer

6=/Schedule to printer/Collate option for Crystal Report

7=/Default Destination

8=/Default Destination/Alter the object destination to default
destination

9=/Default Destination/Schedule to Default Destination





Please help me!

Thank you so much. Any helps will be greatly appreciated.



Regards,

John
Public Sub Alter_TOC()
Dim oParagraph As Word.Paragraph
Dim aRange As Range
Dim aRange2 As Range
Dim aRange3 As Range
Dim aLong As Long
Set aRange = ActiveDocument.Range(0, 0)
ActiveDocument.Paragraphs(1).Range.Delete

With aRange.Find
.Text = " {1,}[0-9]{1,}^13 ^13 {1,}[0-9]{1,}.[0-9]{1,} {1,}"
.Replacement.Text = "/"
.MatchWildcards = True
.Execute replace:=wdReplaceAll
.Text = " {1,}[0-9]{1,} {1,}"
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = " {1,}[0-9]{1,}"
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = "^13 {1,}^13"
.Replacement.Text = "^p^p"
.Execute replace:=wdReplaceAll
.Text = "."
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = "/"
.Replacement.Text = "^&"
While .Execute
Set aRange2 = aRange.Duplicate
Set aRange3 = aRange.Duplicate
aRange3.Expand unit:=wdParagraph
aRange2.MoveStartUntil cset:=Chr(13), Count:=wdBackward
aRange2.MoveEnd unit:=wdCharacter, Count:=-1
With aRange3.Find
.Text = "/"
.Replacement.Text = "^p^p" & aRange2.Text & "/"
.Execute replace:=wdReplaceAll
End With
aRange.SetRange Start:=aRange3.End, End:=ActiveDocument.Content.End
Wend
End With
ActiveDocument.Paragraphs(1).Range.Delete
aLong = 1

For Each oParagraph In ActiveDocument.Paragraphs
If oParagraph.Range.Characters.Count > 1 Then
oParagraph.Range.InsertBefore aLong & "=/"
aLong = aLong + 1
End If
Next oParagraph

End Sub
 
R

Russ

Hi John,

Below is what I tested my subroutine on:
( With original heading, blank paragraphs, and spaces in front of other
paragraphs, etc....Your original example as copied and pasted. Now if the
first subroutine that saves it to a file doesn't write it out like this
example, then you'll have to tweak the code. Run it in step mode to see what
each line is doing. It starts by deleting the first paragraph (Part II...).
Maybe your example was actually using tabs while I was looking for spaces.
If your running on a Mac then you'll have to replace all the ^13 in the code
with \n. You do some programming yourself, don't you? Most of us try to
assist other people's efforts. I just gave you one method of formatting your
example. You don't have to use it. It just might give you ideas on how to do
it on your own. )
Part II Test Cases 7

1 Schedule Document 7

1.1 Cleanup instance after scheduling. 7

1.2 WebI Specific Scheduling. 8

1.3 Document Format 9

2 Schedule to printer 9

2.1 Collate option for Crystal Report 9

3 Default Destination. 11

3.1 Alter the object destination to default destination. 11

3.2 Schedule to Default Destination. 12


Here's What Came Out:

1=/Schedule Document

2=/Schedule Document/Cleanup instance after scheduling

3=/Schedule Document/WebI Specific Scheduling

4=/Schedule Document/Document Format

5=/Schedule to printer

6=/Schedule to printer/Collate option for Crystal Report

7=/Default Destination

8=/Default Destination/Alter the object destination to default destination
Hi Russ,

Thanks for trying but the code didn't work. It only deleting the dot on the
section number for TOC but didn't replacing it again with =/. Thus I need to
hit CTRL+C to stop your code from looping forever.

Please use this page to try your code:
Table Of Contents



Part I Background Information. 7

1 Overview of Feature or System under Test 7

2 Scope of Test 7

3 Assumptions and Constraints 7

3.1 General 8

3.2 Report Database. 8

3.3 3rd party authentication. 8

3.4 Events 8

3.5 What is supported for specific previous versions 8

3.5.1 CE8.5. 8

3.5.2 CE9.0. 8

3.5.3 CE10. 8

3.5.4 BOE11. 9

3.5.5 BOE11.5. 9

4 Resources Requirements 9

4.1 Skill Requirements 9

4.2 Software Requirements 10

4.3 Hardware Requirements 10

5 Test Environment Configuration. 10

5.1 Operation defaults 10

5.2 Create group hierarchy. 10

5.3 User/Group/Folder rights Model 11

5.4 Add and setup BCAP related objects 11

5.5 Add multiple reports and related encyclopedia objects 12

5.6 Import Users and User Groups from Profiles 12

6 Validation Method. 13

6.1 Object properties is set correctly in the destination system. 13

6.2 Importing object from BIAR file pre-condition. 13

6.3 The BCAP specific relation and reference properties are retained. 13

6.4 Large dataset 15

7 Platform Applicable. 15

8 Reference Documents 15

9 Organization of Test Cases 15

Part II Test Cases 16

1 Object Integrity. 16

1.1 User 16

1.2 Group. 16

1.3 Event 17

1.4 Calendar 18

1.5 Folder 18

1.6 Report 19

1.7 Program Object 20

1.8 3rd Party Document 20

1.9 WebI 21

1.10 Hyperlink 22

1.11 Dashboard Page. 22

1.12 Object Package. 23

1.13 OLAP Reports 23

1.14 Scheduling Info for schedulable objects 25

1.14.1 Notification. 25

1.14.2 Destination. 27

1.14.3 Schedule For 30

1.14.4 Report Alert Notification. 31

1.14.5 Format 32

1.14.6 Scheduling and instances 34

1.14.7 Time Zone. 36

2 Object Dependencies 37

2.1 User and User Group. 37

2.1.1 Enterprise User, User Group and Subgroup. 37

2.1.2 3rd Party Authentication Group and User 42

2.1.3 User and his/her Favorites Folder, Inbox and Personal Category. 45

2.1.4 Server group, subgroup and server 46

2.1.5 Viewing/Scheduling with prefered/specified server group. 48

2.1.6 Scheduling with Event 49

2.1.7 Scheduling with Calendar 53

2.1.8 Category and Document 54

2.1.9 Folder and Object Hierarchy. 56

2.1.10 Shortcut and InfoObject it refers to. 57

2.1.11 WebI Document, Universe, Connection. 58

2.1.12 Universe and Connection. 59

2.1.13 Universe, Overload and User 59

2.1.14 Universe and Report 60

2.1.15 Universe and Core-Universe. 61

2.1.16 InfoObject and Discussion. 62

2.1.17 Report and report repository. 63

2.1.18 Report and Processing Extension. 64

2.1.19 Report and Metadata. 65

2.1.20 Report and Dynamic Cascading Parameters 67

2.1.21 BCAP (Publications, Documents, Profiles, Principals, Universes) 68

2.1.22 Document and Encyclopedia Objects 68

2.1.23 Process Tracker Objects 71

3 Export InfoObject to BIAR file. 72

3.1 Object Integrity. 72

3.1.1 User 72

3.1.2 Group. 72

3.1.3 Event 73

3.1.4 Calendar 73

3.1.5 Folder 74

3.1.6 Report 74

3.1.7 Program. 75

3.1.8 3rd Party Document 75

3.1.9 Hyperlink 76

3.1.10 Object Package. 76

3.1.11 OLAP Report 77

3.1.12 Scheduling Info for Schedulable Objects 77

3.1.12.1 Notification. 77

3.1.12.2 Destination. 78

3.1.12.3 Schedule For 79

3.1.12.4 Report Alert Nofification. 80

3.1.12.5 Format 80

3.1.12.6 Scheduling and instances 81

3.2 Object Dependencies 83

3.2.1 User and User Group. 83

3.2.1.1 Enterprise User, User Group and Subgroup. 83

3.2.1.2 3rd Party Authentication Group and User 84

3.2.2 User and his/her Favorites Folder, Inbox and Personal Category. 84

3.2.3 Server group, subgroup and server 85

3.2.4 Viewing/Scheduling with prefered/specified server group. 85

3.2.5 Scheduling with event 86

3.2.6 Category and Document 86

3.2.7 Folder and Object Hierarchy. 87

3.2.8 Shortcut and InfoObject it refers to. 88

3.2.9 InfoObject and Discussion. 88

3.2.10 Report and Report Repository. 89

3.2.11 Report and Processing Extension. 89

3.2.12 Report and Metadata. 89

3.2.13 Report and Dynamic Cascading Parameter 90

3.2.14 BCAP (Publications, Documents, Profiles, Principals, Universes) 91

3.2.15 Document and Encyclopedia Objects 91

3.2.16 Calendar and Report 91

3.2.17 Process Tracker Objects 92

4 Import Rights and Limits Settings 92

4.1 User and Group Rights 92

4.2 Instance Limits for folder and schedulable object 96

5 Importing Scenarios 98

5.1 Merge source system into destination system. 98

5.2 Update destination system using source system as a reference. 101

5.3 Incremental Importing. 103

5.4 Licensing. 103

6 Source and destination CMS selection and logon. 103

6.1 Logging on to source CMS. 103

6.2 Logging on to destination CMS. 104

6.3 Logging on CMS as non-administrator 105

7 Tree control and object displaying. 105

8 Resilience to error conditions 106

8.1 File Server is down. 106

8.2 BIAR file is invalid. 107

9 Importing of large dataset 107

10 Import Users and Profiles 108

10.1 Import file handling. 108

10.1.1 File Format 108

10.1.2 File Size/Type. 110

10.2 Object Creation/Updating. 113

10.2.1 Create Users/Groups/Profiles/Database Credentials 113

10.2.1.1 Users 113

10.2.1.2 Groups 115

10.2.1.3 Profiles 117

10.2.1.4 Database Credentials 118

10.2.2 Update Users/Groups/Profiles/Database Credentials 121

10.2.2.1 Users 121

10.2.2.2 Groups 123

10.2.2.3 Profiles 124

10.2.2.4 Database Credentials 125

10.2.3 Group Membership. 126

10.2.3.1 Add Users to group if not member 126

10.2.3.2 Remove users from group if not included. 127

10.3 User Interface. 128

10.3.1 Dialog flow. 128

10.3.2 Dialog Validation. 129

10.3.3 Specify Source Environment 130

10.3.4 Select options for file import 130

10.3.5 Preview results from file import 131



Thanks,
John

Russ said:
John,
Hi,

I'd like to read the TOC starting from below "Part II test cases" until
the
end of TOC.

See these messages for sending original TOC to a file.
http://tinyurl.com/q8jqc

After that, I need reformat the TOC hierarchy in the format like
below and finally write the result to a text file.

Bring the TOC text file back into Word and run the code below to format
it.
You should be able to combine the two procedures into one, if you want.
Example:

TOC in Ms Word
Part II Test Cases 7

1 Schedule Document 7

1.1 Cleanup instance after scheduling. 7

1.2 WebI Specific Scheduling. 8

1.3 Document Format 9

2 Schedule to printer 9

2.1 Collate option for Crystal Report 9

3 Default Destination. 11

3.1 Alter the object destination to default destination. 11

3.2 Schedule to Default Destination. 12







Text file format:

1=/Schedule Document

2=/Schedule Document/Cleanup instance after scheduling

3=/Schedule Document/WebI Specific Scheduling

4=/Schedule Document/Document Format

5=/Schedule to printer

6=/Schedule to printer/Collate option for Crystal Report

7=/Default Destination

8=/Default Destination/Alter the object destination to default
destination

9=/Default Destination/Schedule to Default Destination





Please help me!

Thank you so much. Any helps will be greatly appreciated.



Regards,

John
Public Sub Alter_TOC()
Dim oParagraph As Word.Paragraph
Dim aRange As Range
Dim aRange2 As Range
Dim aRange3 As Range
Dim aLong As Long
Set aRange = ActiveDocument.Range(0, 0)
ActiveDocument.Paragraphs(1).Range.Delete

With aRange.Find
.Text = " {1,}[0-9]{1,}^13 ^13 {1,}[0-9]{1,}.[0-9]{1,} {1,}"
.Replacement.Text = "/"
.MatchWildcards = True
.Execute replace:=wdReplaceAll
.Text = " {1,}[0-9]{1,} {1,}"
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = " {1,}[0-9]{1,}"
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = "^13 {1,}^13"
.Replacement.Text = "^p^p"
.Execute replace:=wdReplaceAll
.Text = "."
.Replacement.Text = ""
.Execute replace:=wdReplaceAll
.Text = "/"
.Replacement.Text = "^&"
While .Execute
Set aRange2 = aRange.Duplicate
Set aRange3 = aRange.Duplicate
aRange3.Expand unit:=wdParagraph
aRange2.MoveStartUntil cset:=Chr(13), Count:=wdBackward
aRange2.MoveEnd unit:=wdCharacter, Count:=-1
With aRange3.Find
.Text = "/"
.Replacement.Text = "^p^p" & aRange2.Text & "/"
.Execute replace:=wdReplaceAll
End With
aRange.SetRange Start:=aRange3.End, End:=ActiveDocument.Content.End
Wend
End With
ActiveDocument.Paragraphs(1).Range.Delete
aLong = 1

For Each oParagraph In ActiveDocument.Paragraphs
If oParagraph.Range.Characters.Count > 1 Then
oParagraph.Range.InsertBefore aLong & "=/"
aLong = aLong + 1
End If
Next oParagraph

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top