Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-17-2015, 10:18 AM
muiy muiy is offline Macro to capitalize first letter after timecode + tab Windows 8 Macro to capitalize first letter after timecode + tab Office 2013
Novice
Macro to capitalize first letter after timecode + tab
 
Join Date: Jan 2015
Posts: 7
muiy is on a distinguished road
Default Macro to capitalize first letter after timecode + tab

Hello all,



I am looking to write a macro where when I run it, it will capitalize the first letter of any line that has a timecode and then is indented (via TAB). The format of the timecode is this:


0:53:04.9 so I wish the “s” in that first word of this line will get capitalized when I run the new macro I'm trying to create.

(Where the gap between the 9 and the s is a tab-created gap in Word)

I found a way to capitalize the first letter after a colon using the macro I found on this site:

https://cybertext.wordpress.com/2011...to-upper-case/

While searching for a macro that does that I came across several searches that ended on this forum, so I was hoping I could find some help here. I am unfamiliar with VBA at the moment so writing it myself seems challenging. Just looking at the other macro, I'm guessing I need to change the .Text part of the macro to numbers 0-9, and somewhere in the macro I need to specify the tab. Or maybe it should be written from scratch.

Thanks for any help.
Reply With Quote
  #2  
Old 06-17-2015, 11:03 PM
gmayor's Avatar
gmayor gmayor is offline Macro to capitalize first letter after timecode + tab Windows 7 64bit Macro to capitalize first letter after timecode + tab Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following macro should do the job
Code:
Sub FormatTimeCode()
Dim oRng As Range
    Set oRng = ActiveDocument.Range
    With oRng.Find
        Do While .Execute(FindText:="[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,2} [a-z]", MatchWildcards:=True)
            oRng.Characters.Last.Case = wdUpperCase
            oRng.Characters.Last.InsertBefore vbTab
            oRng.Collapse 0
        Loop
    End With
lbl_Exit:
    Set oRng = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to capitalize first letter after timecode + tab Only Capitalize First Letter & Delete Last Name zulhfreelancer Excel 5 12-10-2012 07:51 AM
Exceptions for 'Capitalize first letter of sentences' gazpacho Word 1 01-12-2012 11:43 AM
Macro to capitalize first letter after timecode + tab Macro to get first letter of a page in the header faramir Word VBA 4 11-16-2011 05:43 AM
Macro to capitalize first letter after timecode + tab is it possibe to capitalize every letter after a "colon space" angeltread Word VBA 4 01-17-2011 03:50 PM
capitalize first letter of sentences norco1 Word 0 06-25-2006 12:37 PM

Other Forums: Access Forums

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


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