G
Grant
Hello,
I created the following word macro in VBA to go through the current folder
opening up all word documents and deleting the footnotes from them. Footnote
text and numbers are deleted but when I go back into the document and click
on 'View', I can still select footnotes - which means there are still
footnote references so they havent been completely deleted. When I view the
footnotes section - there is no text BUT threre are full stop characters
with 'Footnote Text' formatting, which I dont know how to get rid of??? The
wierd thing is that before in the main document text there were numbers to
indicate footnotes but they have all been deleted - but if I select one of
the full stops in the footnote section, the main document jumps to a certain
point - but there is no footnote number there, its as if though the number
has been replaced by one of the text characters.
Can anyone show me why my code didnt completely delete the footnotes? The
only other way I know iof doing it is to open each document and do a search
and replace manually, which would take ages.
-----------------------------------------------
Sub DeleteFootnotes()
Dim strDirName
Dim strFileName
Dim intFootnoteCounter As Integer
Dim objFileSystem
Dim objFolder
Dim objDocument As Document
strDirName = ActiveDocument.Path & "\"
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFileSystem.GetFolder(strDirName)
'Iterate through the files in the folder
For Each objFile In objFolder.Files
Set objDocument = Documents.Open(strDirName + objFile.Name)
For Each objFootNote In objDocument.Footnotes
objFootNote.Delete
Next objFootNote
objDocument.Save
objDocument.Close
Next objFile
MsgBox ("Footnotes deleted,.. well.. maybe")
End Sub
I created the following word macro in VBA to go through the current folder
opening up all word documents and deleting the footnotes from them. Footnote
text and numbers are deleted but when I go back into the document and click
on 'View', I can still select footnotes - which means there are still
footnote references so they havent been completely deleted. When I view the
footnotes section - there is no text BUT threre are full stop characters
with 'Footnote Text' formatting, which I dont know how to get rid of??? The
wierd thing is that before in the main document text there were numbers to
indicate footnotes but they have all been deleted - but if I select one of
the full stops in the footnote section, the main document jumps to a certain
point - but there is no footnote number there, its as if though the number
has been replaced by one of the text characters.
Can anyone show me why my code didnt completely delete the footnotes? The
only other way I know iof doing it is to open each document and do a search
and replace manually, which would take ages.
-----------------------------------------------
Sub DeleteFootnotes()
Dim strDirName
Dim strFileName
Dim intFootnoteCounter As Integer
Dim objFileSystem
Dim objFolder
Dim objDocument As Document
strDirName = ActiveDocument.Path & "\"
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFileSystem.GetFolder(strDirName)
'Iterate through the files in the folder
For Each objFile In objFolder.Files
Set objDocument = Documents.Open(strDirName + objFile.Name)
For Each objFootNote In objDocument.Footnotes
objFootNote.Delete
Next objFootNote
objDocument.Save
objDocument.Close
Next objFile
MsgBox ("Footnotes deleted,.. well.. maybe")
End Sub