UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Editing Out (delete All) Between Section Marks (§), Office 2013    
 
   
zocker
post Feb 25 2020, 09:49 AM
Post#1


Utterly Eccentric and Moderator
Posts: 4,100
Joined: 4-March 00
From: Bristol / Ipswich / Spain/Gloucester


Greetings All!

[Word 2017 or later!]

I am helping out some undergraduate Creative Writing students with their work by adding my corrections and comment between section markers - these: §

So after my editing the text will look Like:

Blah blah.....a bench is in front of the machine, there are §could be§ painted images of washing...blah blah.

It does not have to be §'s but I see no reason why not. My question is: is it possible that the students could later, when their own editing is complete, delete all the characters of the included text and the §'s themselves. I'd like to do this with a {F2} button..or other unused Function Key or Ctrl + (a key) . There will be many of my comments so this should be a huge time saver..and boredom avoider!

Many thanks in advance!

Zocker aka James Woodard

--------------------
I think they're for 1 am. Rene Descartes
Go to the top of the page
 
Vince
post Feb 25 2020, 09:57 AM
Post#2



Posts: 78
Joined: 18-August 16
From: Bristol, UK


Can you use find & replace? If you click the 'more' box on the replace tab there is an option to use wildcards, so find §*§ and replace with blank.
Go to the top of the page
 
DanielPineault
post Feb 25 2020, 10:17 AM
Post#3


UtterAccess VIP
Posts: 7,262
Joined: 30-June 11



Perhaps using RegEx
CODE
Function RemoveText(sString As String) As String
    On Error GoTo Error_Handler
    Dim oRegEx          As Object

    Set oRegEx = CreateObject("VBScript.RegExp")

    With oRegEx
        .Pattern = " §(.*)§"
        .Global = True
        .IgnoreCase = True
        .MultiLine = True
    End With

    RemoveText = oRegEx.Replace(sString, "")

Error_Handler_Exit:
    On Error Resume Next
    Set oRegEx = Nothing
    Exit Function

Error_Handler:
    MsgBox "The following error has occurred." & vbCrLf & vbCrLf & _
           "Error Number: " & Err.Number & vbCrLf & _
           "Error Source: RemoveText" & vbCrLf & _
           "Error Description: " & Err.Description, _
           vbCritical, "An Error has Occurred!"
    Resume Error_Handler_Exit
End Function


RemoveText("Blah blah.....a bench is in front of the machine, there are §could be§ painted images of washing...blah blah.")
Returns -> Blah blah.....a bench is in front of the machine, there are painted images of washing...blah blah.


Also, what about using Word built-in Replace (Ctrl+H) -> §*§ be sure to have selected the Use wildcards in the Search Options and use the Replace All command.
Attached File(s)
Attached File  2020_02_25_10_13_31.png ( 17.24K )Number of downloads: 0
 

--------------------
Daniel Pineault (2010-2019 Microsoft MVP, UA VIP, EE Distinguished Expert 2018)
Professional Help: https://www.cardaconsultants.com
Free MS Access Code, Tips, Tricks and Samples: https://www.devhut.net

* Design should never say "Look at me". It should always say "Look at this". -- David Craib
* A user interface is like a joke, if you have to explain it, it's not that good! -- Martin LeBlanc


All code samples, demonstration databases, links,... are provided 'AS IS' and are to be used at your own risk! Take the necessary steps to check, validate ...(you are responsible for your choices and actions)
Go to the top of the page
 
BruceM
post Feb 25 2020, 11:04 AM
Post#4


UtterAccess VIP
Posts: 8,056
Joined: 24-May 10
From: Downeast Maine


I would have suggested what Vince suggested, although maybe §*§<space> (which is to say a space character). If code, how would it be deployed? An add-in could work, but I don't know how to associate the macro with a shortcut key combination without setting it up in each user's version of Word. I expect it's possible, but I don't know how.
Go to the top of the page
 
zocker
post Feb 25 2020, 11:11 AM
Post#5


Utterly Eccentric and Moderator
Posts: 4,100
Joined: 4-March 00
From: Bristol / Ipswich / Spain/Gloucester


Thanks for your quick reply! I hadn't thought there'd be built-in stuff for that...with a bit of VBA skulduggery I can do what i want! Thanks again and from the students!

Thanks also Daniel! I can use a combination o both!

Zocker

--------------------
I think they're for 1 am. Rene Descartes
Go to the top of the page
 
zocker
post Feb 25 2020, 11:17 AM
Post#6


Utterly Eccentric and Moderator
Posts: 4,100
Joined: 4-March 00
From: Bristol / Ipswich / Spain/Gloucester


If the code or Maro is written in 'This Document' does it not 'travel' with the doc? I will experiment....
I'll bet it wont travel over differing Word versions 'tho....and it might also incur the wrath of anti-virus/macro scanners.

Z

--------------------
I think they're for 1 am. Rene Descartes
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    7th April 2020 - 12:24 PM