Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-30-2021, 04:34 PM
drrr drrr is offline i want to add a line break after selection word 19 Windows 10 i want to add a line break after selection word 19 Office 2019
Novice
i want to add a line break after selection word 19
 
Join Date: Jul 2021
Posts: 9
drrr is on a distinguished road
Default i want to add a line break after selection word 19

Sub cloze()


'
' Macro2 Macro
'
Selection.InsertBefore Text:="{{c1::"
Selection.InsertAfter Text:="}}"


'
End Sub


i want to add a line break after selection
i want something like Selection.InsertAfter Text:="line break"
but this adds text not an actual line break
Reply With Quote
  #2  
Old 07-30-2021, 08:27 PM
gmayor's Avatar
gmayor gmayor is offline i want to add a line break after selection word 19 Windows 10 i want to add a line break after selection word 19 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Do you mean like
Code:
Sub cloze()
'
' Macro2 Macro
'
Selection.InsertBefore Text:="{{c1::"
Selection.InsertAfter Text:="}}" & vbCr
Selection.Collapse 0


'
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 07-31-2021, 10:43 AM
drrr drrr is offline i want to add a line break after selection word 19 Windows 10 i want to add a line break after selection word 19 Office 2019
Novice
i want to add a line break after selection word 19
 
Join Date: Jul 2021
Posts: 9
drrr is on a distinguished road
Default thank you

works perfectly
Reply With Quote
  #4  
Old 07-31-2021, 11:23 AM
drrr drrr is offline i want to add a line break after selection word 19 Windows 10 i want to add a line break after selection word 19 Office 2019
Novice
i want to add a line break after selection word 19
 
Join Date: Jul 2021
Posts: 9
drrr is on a distinguished road
Default

One last thing, how to insert a quote with InsertBefore method

InsertBefore Text:="""

How does escaping work?
I tried \ and / but neither work
i tried single quote as in the picture but some error occurred

Reply With Quote
  #5  
Old 07-31-2021, 09:03 PM
gmayor's Avatar
gmayor gmayor is offline i want to add a line break after selection word 19 Windows 10 i want to add a line break after selection word 19 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I think what you want is


Code:
Sub Quote()
Selection.InsertBefore Chr(34)
Selection.InsertAfter Chr(34) & ",  ," & vbCr
Selection.MoveEnd 6 'the number of characters added after the selection
Selection.Collapse 0
End Sub

'0r
Sub Quote2()
Selection.InsertBefore """"
Selection.InsertAfter """,  ," & vbCr
Selection.MoveEnd 6 'the number of characters added after the selection
Selection.Collapse 0
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #6  
Old 08-01-2021, 07:06 AM
drrr drrr is offline i want to add a line break after selection word 19 Windows 10 i want to add a line break after selection word 19 Office 2019
Novice
i want to add a line break after selection word 19
 
Join Date: Jul 2021
Posts: 9
drrr is on a distinguished road
Default

thank you. You are brilliant
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
i want to add a line break after selection word 19 Removing line break and indentation between footnote number and footnote text in Word jaanross Word 5 02-06-2020 12:04 AM
Section and Line Break leaving line on previous page Stonehands99 Word 5 08-13-2019 08:59 PM
i want to add a line break after selection word 19 Word converts section break to page break before columns, does not insert column breaks eborda Word 1 03-24-2017 11:06 PM
Interchange line break and paragraph break shortcut keys skan Word 2 01-20-2017 03:50 AM
i want to add a line break after selection word 19 Add paragraph break to the end of each line in Microsoft Word? vaga95 Word 1 06-24-2016 08:19 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:21 AM.


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