Hi Everyone,
I have the following code:
<code>
Dim lCount As Long
Dim sEnd As String
Dim oDoc As Document
sEnd = "Endnotes" & vbCrLf
For lCount = 1 To ActiveDocument.Endnotes.Count
sEnd = sEnd & lCount & vbTab &
ActiveDocument.Endnotes(lCount).Range.Text & vbCrLf
Next lCount
sEnd = sEnd & "Footnotes" & vbCrLf
For lCount = 1 To ActiveDocument.Footnotes.Count
sEnd = sEnd & lCount & vbTab &
ActiveDocument.Footnotes(lCount).Range.Text & vbCrLf
Next lCount
Set oDoc = Documents.Add
oDoc.Range.Text = sEnd
</code>
and it is supposed to extract all footnotes and endnotes in a word file into a new file. BUT, I get the following error :
"Compile Error: Invalid Outside Procedure"
Can anyone help me to get this to work ?????
Thanks
I have the following code:
<code>
Dim lCount As Long
Dim sEnd As String
Dim oDoc As Document
sEnd = "Endnotes" & vbCrLf
For lCount = 1 To ActiveDocument.Endnotes.Count
sEnd = sEnd & lCount & vbTab &
ActiveDocument.Endnotes(lCount).Range.Text & vbCrLf
Next lCount
sEnd = sEnd & "Footnotes" & vbCrLf
For lCount = 1 To ActiveDocument.Footnotes.Count
sEnd = sEnd & lCount & vbTab &
ActiveDocument.Footnotes(lCount).Range.Text & vbCrLf
Next lCount
Set oDoc = Documents.Add
oDoc.Range.Text = sEnd
</code>
and it is supposed to extract all footnotes and endnotes in a word file into a new file. BUT, I get the following error :
"Compile Error: Invalid Outside Procedure"
Can anyone help me to get this to work ?????
Thanks