Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 10-19-2019, 09:06 PM
gmayor's Avatar
gmayor gmayor is offline Automatically format specific parts of a word document Windows 10 Automatically format specific parts of a word document Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
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 ofgmayor has much to be proud of
Default

It is not quite the same as Excel, but as Greg suggests it is just a matter of setting a range to the place you want to process. e.g.

Code:
Sub Macro1()
Dim oTable As Table
Dim oCell As Range
Set oTable = ActiveDocument.Tables(1)    'where 1 is the first table
    'or
    'Set oTable = Selection.Tables(1) 'which is the table the cursor is in
    Set oCell = oTable.Rows(1).Cells(1).Range 'the first cell in the top row
    oCell.End = oCell.End - 1    'omit the cell end character from the range
    oCell.Text = UCase(oCell.Text)    'make the cell range upper case
    Set oCell = Nothing
    Set oTable = Nothing
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
 

Tags
autoformat, formatting data, vba code



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically format specific parts of a word document Can Macros Automatically Format an Entire Document to My Specifications CrossReach Word VBA 4 11-14-2017 12:51 PM
Automatically format specific parts of a word document Pulling parts of a webpage down to Word document Bungkai Word VBA 1 12-17-2015 10:48 PM
Add pictures in specific parts of the document and resize them automatically - MS Word 2013 Andrew_G93 Word 6 11-10-2015 09:00 AM
Automatically format specific parts of a word document Adding and Moving parts of a document in Word PauledInAction Word 4 07-13-2012 02:38 PM
Automatically format specific parts of a word document Can you prevent parts of a Word document from printing? mgp69 Word 4 04-04-2012 02:12 PM

Other Forums: Access Forums

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