Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-25-2021, 01:46 PM
Steve Kunkel Steve Kunkel is offline Duplicate line and/or comment in editor? Windows 10 Duplicate line and/or comment in editor? Office 2019
Advanced Beginner
Duplicate line and/or comment in editor?
 
Join Date: May 2019
Location: Seattle area
Posts: 77
Steve Kunkel is on a distinguished road
Default Duplicate line and/or comment in editor?

Hi Folks,
In the VBA Editor that comes with Word, is there a command to "duplicate current line?" Upon searching the VBAE and Google, it seems like there is not. But maybe I'm missing something? Surely this is a pretty common need that people have??



Similarly, I can't find a command to "Comment in/out" a block of code...

Thoughts?

EDIT: I did find the "comment/uncomment" toolbar buttons. I guess by default they are not in the menus...

Last edited by Steve Kunkel; 04-25-2021 at 01:52 PM. Reason: update
Reply With Quote
  #2  
Old 04-25-2021, 02:02 PM
macropod's Avatar
macropod macropod is offline Duplicate line and/or comment in editor? Windows 10 Duplicate line and/or comment in editor? Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

A command to duplicate a line (which there isn't) would likely take as many or more keystrokes to implement as a simple copy/paste.

The 'Edit' toolbar has buttons to "Comment/Uncomment" a block of code. You can activate that toolbar via View|Toolars|Edit.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 04-26-2021, 12:31 PM
Steve Kunkel Steve Kunkel is offline Duplicate line and/or comment in editor? Windows 10 Duplicate line and/or comment in editor? Office 2019
Advanced Beginner
Duplicate line and/or comment in editor?
 
Join Date: May 2019
Location: Seattle area
Posts: 77
Steve Kunkel is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
A command to duplicate a line (which there isn't) would likely take as many or more keystrokes to implement as a simple copy/paste.
Not sure if I agree on the number of keystrokes... I tried to make a VBA macro to automate the keystrokes needed for duplicating a line and then commenting-out the top copy. Apparently VBA macros can't run inside the editor, so I made one with the awesome and opensource AutoHotkey Windows scripting language. Code is below.

WARNING -- NOT VBA CODE!
Code:
SetTitleMatchMode, 2 ; Win titles must contain specified string.

#ifWinActive, Microsoft Visual Basic for Applications 
!c:: ;Alt-c activates it, but only in VBA Editor
send {End}
send +{Home} ;shift+home
send ^c ;copy
send '^v ;apostrophe, paste
send {Enter}
send ^v ;paste
return
#ifWinActive
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate line and/or comment in editor? How to put a diagonal line through a character or expression in the Word 2007 Equation Editor RobertWA Word 3 11-07-2020 06:58 AM
Force one line functions using equation editor awa5114 Word 0 05-30-2017 03:30 AM
Duplicate Line Displayed LarryStroup Word 3 06-05-2015 03:20 AM
Duplicate line and/or comment in editor? VBA to solve duplicate words in one line Bookmaster Word VBA 7 02-03-2015 04:30 PM
Duplicate line and/or comment in editor? How to insert a (balloon) comment and how to disable comment feature in Word2007? pstein Word 2 03-31-2012 05:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:24 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