Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VBA Word: Bold cell's text till break line

Posted on 2011-09-08
2
Medium Priority
?
638 Views
Last Modified: 2013-11-28
I need to go through one column in my word table and change font to bold for all characters from the first one to first breakline so that would be the string im interested in:

                zz = Left(oCell.Range.Text, InStr(oCell.Range.Text, Chr(13)) - 1)

Im having difficulties in highlighting the 'zz' part of every cell


With appWord
            For Each oCell In .Tables(1).Range.Columns(2).Cells
                

                With .Selection
                    .Bold = True
                End With
            Next
        End With

Open in new window

0
Comment
Question by:yahooooo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 36501164
You need to work on a document, not application, so I've renamed the variable to emphasise that
With docWord
        For Each oCell In .Tables(1).Range.Columns(2).Cells
            oCell.Range.Paragraphs.First.Range.Bold = True
        Next
    End With

Open in new window

0
 
LVL 3

Author Comment

by:yahooooo
ID: 36501239
sry for confusion, i should put on top Dim appWord As Object as well

works great :D Didnt think that I can treat cell like a word document ;)
 thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question