Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-19-2017, 03:10 AM
dejanm83 dejanm83 is offline Word macro - remove shading from active para. and assign language to it, keep text cursor position Windows 10 Word macro - remove shading from active para. and assign language to it, keep text cursor position Office 2013
Novice
Word macro - remove shading from active para. and assign language to it, keep text cursor position
 
Join Date: Mar 2017
Posts: 2
dejanm83 is on a distinguished road
Default Word macro - remove shading from active para. and assign language to it, keep text cursor position

Hello,

I am trying to create a macro that would do what the subject says, i.e. remove shading from the paragraph in which the text cursor is located, and assign language to that paragraph, while keeping the position of the text cursor.

I tried to do this by recording my actions in a macro - I select the whole paragraph, start a new macro (name it, assign a keyboard shortcut) - click the shading icon in the toolbar and pick No Color, then invoke the language menu and select and confirm the desired language - and stop recording.



The macro then looks like this:

Sub EngUSNoBackground()
'
' Macro1 Macro
'
'
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorAutomatic
Selection.LanguageID = wdEnglishUS
Selection.NoProofing = False
End Sub

What this does when I run it while nothing is selected, is only remove shading from the whole document, and does not assign the language. When I run it again, then it changes the language of only the word where the cursor is.

I could work around this by recording two steps before anything else (Ctrl+Up, Ctrl+Shift+Down) to select the paragraph, and that does the trick, but I want to keep the position of the text cursor in the paragraph.


Can anyone help me with this, what do I need to put into the macro for it to be applied to the active paragraph, without having to select the text of the paragraph first?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to assign color to an active worksheet jane.bugai Excel Programming 5 03-03-2017 08:39 AM
Word macro - remove shading from active para. and assign language to it, keep text cursor position Cursor Position; WORD 2007 Question, Please Robert11 Word 3 11-27-2015 09:42 PM
changing cursor position anand Word VBA 2 06-19-2015 05:18 AM
Word macro - remove shading from active para. and assign language to it, keep text cursor position Get para no where txt is found, and move text to end of paragraph using Word 201 marceepoo Word VBA 2 12-20-2012 11:42 AM
Macro for absolute text box re-position hobbsbaboo PowerPoint 0 03-15-2012 01:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:36 PM.


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