G
GMC
Hi,
I have an rtf document which containts multiple tables with a text heading
above each table.
What i want to achieve is to extract each table as a seperate file and have
it saved as the text name that exists above each table. Additionally i would
like to save the file into a pre-created template.
The code for extracting the files (as found on this forum) is as follows:
Sub DocExtract()
Dim iDoc As Integer ' number of dcouments
Dim dDc1 As Document ' active document
Dim dDc2 As Document ' new document
Dim rTmp As Range ' temporary range
Set dDc1 = ActiveDocument
For iDoc = 1 To dDc1.Tables.Count
Set rTmp = ActiveDocument.Tables(iDoc).Range
rTmp.Copy
Set dDc2 = Documents.Add(Visible:=False)
dDc2.Activate
Selection.Paste
dDc2.SaveAs "C:\Test\" & Format(iDoc, "000") & ".doc"
dDc2.Close
Next
Set dDc1 = Nothing
Set dDc2 = Nothing
End Sub
Need to modify this to deal with the required steps. Hoping someone is able
to offer some assistance.
Thanks
I have an rtf document which containts multiple tables with a text heading
above each table.
What i want to achieve is to extract each table as a seperate file and have
it saved as the text name that exists above each table. Additionally i would
like to save the file into a pre-created template.
The code for extracting the files (as found on this forum) is as follows:
Sub DocExtract()
Dim iDoc As Integer ' number of dcouments
Dim dDc1 As Document ' active document
Dim dDc2 As Document ' new document
Dim rTmp As Range ' temporary range
Set dDc1 = ActiveDocument
For iDoc = 1 To dDc1.Tables.Count
Set rTmp = ActiveDocument.Tables(iDoc).Range
rTmp.Copy
Set dDc2 = Documents.Add(Visible:=False)
dDc2.Activate
Selection.Paste
dDc2.SaveAs "C:\Test\" & Format(iDoc, "000") & ".doc"
dDc2.Close
Next
Set dDc1 = Nothing
Set dDc2 = Nothing
End Sub
Need to modify this to deal with the required steps. Hoping someone is able
to offer some assistance.
Thanks