Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2014, 11:56 PM
orjanmen orjanmen is offline Multiple macros on same shortcut Windows 8 Multiple macros on same shortcut Office 2010 64bit
Novice
Multiple macros on same shortcut
 
Join Date: Jun 2014
Posts: 7
orjanmen is on a distinguished road
Default

Thanks! This is the code I ended up with. There is one issue thou! Some times it will not execute if the documents start with yellow background fill. And some times it will not execute if the document starts with black background fill.

Is there a reason for that? There is no problem to start with a black background, but it don's seem consequent.

Code:
Sub BytteFargekombinasjon()
With ActiveDocument
    With .Background.Fill
        .ForeColor.TintAndShade = 0
        .Visible = msoTrue
        .Solid
    End With
    Select Case .Range.Font.ColorIndex
    Case wdWhite 'HvitSkrift
        Select Case .Background.Fill.ForeColor.RGB
        Case RGB(0, 0, 255) 'BlåBakgrunn
            .Background.Fill.ForeColor.RGB = RGB(0, 0, 0) 'SvartBakgrunn
        Case RGB(0, 0, 0) 'Svart
            .Range.Font.ColorIndex = wdAuto
            .Background.Fill.ForeColor.RGB = RGB(255, 255, 255) 'HvitBakgrunn
        End Select
    Case wdAuto, wdBlack 'SvartSkrift
        Select Case .Background.Fill.ForeColor.RGB
        Case RGB(255, 255, 255) 'HvitBakgrunn
            .Background.Fill.ForeColor.RGB = RGB(255, 255, 0) 'GulBakgrunn
        Case RGB(255, 255, 0)
            .Range.Font.ColorIndex = wdWhite
            .Background.Fill.ForeColor.RGB = RGB(0, 0, 255) 'BlåBakgrunn
        End Select
    End Select
End With
End Sub


Last edited by macropod; 06-30-2014 at 12:02 AM. Reason: Added code formatting
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple macros on same shortcut shortcut key to namebox? gsrikanth Excel 8 11-05-2022 04:10 AM
Multiple macros on same shortcut Document as shortcut? sparkync Office 3 08-04-2012 03:26 PM
Multiple macros on same shortcut office xp shortcut nja Word VBA 1 10-24-2009 05:07 AM
Where is the MS Office Shortcut Bar? vwm12345 Office 0 11-14-2008 04:30 AM
Style shortcut billzant Word 0 01-06-2007 02:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:55 AM.


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