Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2019, 03:50 PM
eduzs eduzs is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2010 32bit
Expert
Hide footnote numbering with vba
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default Hide footnote numbering with vba

For a specific projet I need do remove, or, if it's not possible, hide footnote numbering with vba, or any equivalent possible solution with same result.
Example:
Footnote:

"------
1 My footnote"
Expected result:
"------
My footnote"


Thanks.
Reply With Quote
  #2  
Old 08-25-2019, 10:32 AM
jjfreedman jjfreedman is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2016
Advanced Beginner
 
Join Date: May 2012
Location: https://jay-freedman.info
Posts: 39
jjfreedman is on a distinguished road
Default

Modify the Footnote Reference style to include "Hidden" as a font format. The numbers will be hidden in both the footnote itself and the location in the text that refers to it.
Reply With Quote
  #3  
Old 08-25-2019, 11:55 AM
eduzs eduzs is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2010 32bit
Expert
Hide footnote numbering with vba
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default

Code:
activedocument.Styles(wdStyleFootnoteReference).Font.Hidden = True
Not working, nothing occurs.
Currently I'm setting the color of the font to white.
With this, the numbering is invisible, but still uses a space before the footnote (one chr(2) and one chr(32) ), but this is almost irrelevant.
Thanks
Reply With Quote
  #4  
Old 08-25-2019, 01:56 PM
jjfreedman jjfreedman is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2016
Advanced Beginner
 
Join Date: May 2012
Location: https://jay-freedman.info
Posts: 39
jjfreedman is on a distinguished road
Default

Sorry, running the same code (or modifying the style through the Modify Style dialog) here does hide the numbers. Can you verify that the numbers in your document actually have the Footnote Reference style applied to them? That's the default behavior of the References > Insert Footnote button, but yours could have been inserted some other way.
Reply With Quote
  #5  
Old 08-25-2019, 02:49 PM
eduzs eduzs is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2010 32bit
Expert
Hide footnote numbering with vba
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default

Quote:
Originally Posted by jjfreedman View Post
Sorry, running the same code (or modifying the style through the Modify Style dialog) here does hide the numbers. Can you verify that the numbers in your document actually have the Footnote Reference style applied to them? That's the default behavior of the References > Insert Footnote button, but yours could have been inserted some other way.
Thanks! Just need to add this line and now it's working:
Code:
activedocument.Styles(wdStyleFootnoteReference).Font.Hidden=false
activedocument.ActiveWindow.View.ShowHiddenText=False
Now I'm looking for a way to get rid of the blank space (chr(32)) before the footnote text.
This is not working (it's removing entire footnote):
Code:
ActiveDocument.Footnotes(1).Reference.Text = Replace(ActiveDocument.Footnotes(1).Reference.Text, Chr(32), "")
Thanks!

Last edited by eduzs; 08-25-2019 at 06:14 PM.
Reply With Quote
  #6  
Old 08-27-2019, 07:38 AM
gmaxey gmaxey is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Try this:

Code:
Sub Test()
Dim oRng As Range
  ActiveDocument.Styles(wdStyleFootnoteReference).Font.Hidden = False
  Set oRng = ActiveDocument.StoryRanges(wdFootnotesStory)
  With oRng.Find
    .Style = "Footnote Reference"
    While .Execute
      oRng.Characters.Last.Next.Delete
      oRng.Text = vbNullString
    Wend
  End With
  ActiveDocument.Styles(wdStyleFootnoteReference).Font.Hidden = True
  ActiveDocument.ActiveWindow.View.ShowHiddenText = False
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #7  
Old 08-27-2019, 04:06 PM
eduzs eduzs is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2010 32bit
Expert
Hide footnote numbering with vba
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default

This seem not working, nothing occurs.
Reply With Quote
  #8  
Old 08-27-2019, 05:40 PM
gmaxey gmaxey is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

What occurs here is the the footnote numbers in the text and in the footnote section of the document are removed along the space after the number.
Attached Images
File Type: jpg UNFN.jpg (8.6 KB, 12 views)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #9  
Old 08-28-2019, 03:11 AM
eduzs eduzs is offline Hide footnote numbering with vba Windows 10 Hide footnote numbering with vba Office 2010 32bit
Expert
Hide footnote numbering with vba
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
What occurs here is the the footnote numbers in the text and in the footnote section of the document are removed along the space after the number.
Sorry! I translated the style name to my region as end notes not footnotes, now fixed, works fine!
Thanks gmaxey and jjfreedman.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide footnote numbering with vba Adding footnote number as part of footnote text NoCalScribe Word VBA 3 07-15-2019 07:20 PM
Hide footnote numbering with vba Problem with footnote numbering -- Two different footnote levels mdhg Word 7 05-19-2016 06:33 AM
Hide footnote numbering with vba How to change the font of footnote numbering? mudum Word 2 12-03-2015 06:27 AM
Hide footnote numbering with vba Footnote numbering problem within single section jsswadley Word 2 03-17-2015 04:44 PM
Footnote get double numbering malgorzata Word 2 12-12-2014 12:45 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:20 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft