Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2020, 05:14 PM
puff puff is offline [Code attached] Macro can only be triggered inside editor but not shortcut keys Windows 7 64bit [Code attached] Macro can only be triggered inside editor but not shortcut keys Office 2013
Advanced Beginner
[Code attached] Macro can only be triggered inside editor but not shortcut keys
 
Join Date: Apr 2017
Posts: 60
puff is on a distinguished road
Question [Code attached] Macro can only be triggered inside editor but not shortcut keys

Hi. I have a macro below and it's assigned to Ctrl + Shift + =.


Code:
Sub Test()
    With Selection
        If .OMaths.Count = 0 Then 'This means the selection isn't inside a formula
            .TypeText Text:=" " 
            .MoveLeft Unit:=wdCharacter, Count:=1 
            .Font.Superscript = wdToggle
        Else 'Anything that isn't 0 means you're selecting something inside a formula
            .OMaths(1).Functions.add Range:=Selection.Range, Type:=wdOMathFunctionScrSup
            .MoveRight Unit:=wdCharacter, Count:=1 
        End If
    End With
End Sub
For normal texts, the shortcut keys work. However, the shortcut keys don't work for formulas--instead I have to trigger it from the editor. Could someone have a look and help solve this issue? Thanks!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning shortcut keys via a macro file alex100 Word VBA 6 06-26-2020 09:27 AM
macro used to activate shortcut keys hudsontucker13 PowerPoint 1 12-14-2013 09:47 AM
Outlook Mail Shortcut Keys? gratiot Outlook 3 07-29-2011 10:31 AM
cant use shortcut keys (ctrl+c/v/z...) laro Office 0 10-08-2010 11:01 PM
Can't Assign Shortcut Keys Vicki F. Word 0 04-17-2010 03:03 PM

Other Forums: Access Forums

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