Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 08-03-2023, 11:40 AM
darkmaster006 darkmaster006 is offline Simulate a key press (left arrow) Windows 10 Simulate a key press (left arrow) Office 2021
Novice
Simulate a key press (left arrow)
 
Join Date: Aug 2023
Posts: 10
darkmaster006 is on a distinguished road
Default

Quote:
Originally Posted by Italophile View Post
It is very rare that you need to select anything when using VBA code. Here is your routine rewritten to avoid selecting the text.

Code:
Sub AutoOpen()
    '
    ' AutoOpen Macro
    '
    ' This macro opens itself (AutoOpen) automatically with every Word document that's opened normally
    ' Choose background colour (light green 2)
    With ActiveDocument.Background.Fill
        .ForeColor.ObjectThe meColor = wdThemeColorAccent6
        .ForeColor.TintAndSh ade = 0.6
        .Visible = msoTrue
        .Solid
    End With
    ' Turn option 'Show background colors and images in Display view' on
    ActiveWindow.View.DisplayBackgrounds = True
    ' Select all text and change font to black colour
    ActiveDocument.Content.Font.Color = wdColorBlack
End Sub
Thank you, yes, this was better than what I could come up with, thank you very much!
Reply With Quote
 

Tags
key presses



Similar Threads
Thread Thread Starter Forum Replies Last Post
TOC goes into update after using the QAT back button or Alt and left arrow key to return craigt Word 7 01-30-2023 05:45 AM
left - right arrow keys don't function properly natanzel Word 1 06-27-2017 04:38 AM
Simulate a key press (left arrow) Problem with [Ctrl] + [Left Arrow] in Word 2010 (32bit) alxx86 Word 4 03-03-2016 07:22 AM
Simulate a key press (left arrow) Why does the circular and U Turn arrow only go left to right? Cerdic PowerPoint 1 10-22-2013 07:16 PM
Left arrow won't work on Word LaBecs Word 2 09-26-2011 09:27 AM

Other Forums: Access Forums

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