Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-27-2018, 05:54 PM
Snoorelax Snoorelax is offline Macro to write bold and unformatted text in a single cell Windows 10 Macro to write bold and unformatted text in a single cell Office 2016
Novice
Macro to write bold and unformatted text in a single cell
 
Join Date: Jun 2018
Posts: 2
Snoorelax is on a distinguished road
Exclamation Macro to write bold and unformatted text in a single cell

Hey guys I need help.

I need to replace a single cell in the first table of the document, and the cell contains text in bold and underline and the other half with no format. i'm currently using add and everything is in bold and underline but i can't seem to get it to clear the format for only half. this is my current code:

Sub ADD()
'
' ADD Macro
'
'


With ActiveDocument.Tables(1).Cell(1, 3).Range


.Text = "Precon Cycles 6"

End With

With ActiveDocument.Tables(1).Cell(2, 3).Range
.Text = "Precon Temp 260"

End With

I need to make the 6 non bold and underline while the rest is. How may i go about doing this?
Reply With Quote
  #2  
Old 06-27-2018, 06:14 PM
macropod's Avatar
macropod macropod is offline Macro to write bold and unformatted text in a single cell Windows 7 64bit Macro to write bold and unformatted text in a single cell Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
With ActiveDocument.Tables(1)
  With .Cell(1, 3).Range
    .Text = "Precon Cycles 6"
    .End = .End - 3
    With .Font
      .Underline = wdUnderlineSingle
      .Bold = True
    End With
  End With
  With .Cell(2, 3).Range
    .Text = "Precon Temp 260"
  End With
End With
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-27-2018, 06:24 PM
Snoorelax Snoorelax is offline Macro to write bold and unformatted text in a single cell Windows 10 Macro to write bold and unformatted text in a single cell Office 2016
Novice
Macro to write bold and unformatted text in a single cell
 
Join Date: Jun 2018
Posts: 2
Snoorelax is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Try:
Code:
With ActiveDocument.Tables(1)
  With .Cell(1, 3).Range
    .Text = "Precon Cycles 6"
    .End = .End - 3
    With .Font
      .Underline = wdUnderlineSingle
      .Bold = True
    End With
  End With
  With .Cell(2, 3).Range
    .Text = "Precon Temp 260"
  End With
End With
Thank you so much, i've modified the code and ended up with this. You're a life saver


With ActiveDocument.Tables(1)
With .Cell(1, 3).Range
.Bold = False
.Underline = False
.Text = "Precon Cycles 6"
.End = .End - 3
With .Font
.Underline = wdUnderlineSingle
.Bold = True
End With
End With
With .Cell(2, 3).Range
.Text = "Precon Temp 260"
End With
End With
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to write bold and unformatted text in a single cell Looking for VBA or Macro Counting a specific value occuring in single, random, changing cell? blackjack Excel Programming 1 09-11-2014 11:27 PM
Macro to write bold and unformatted text in a single cell Unformatted text paste macro Ulodesk Outlook 1 07-03-2014 02:03 PM
Macro to write bold and unformatted text in a single cell Can I create a single-cell table that moves with the text? lcaretto Word Tables 7 11-01-2013 06:04 AM
Macro to write bold and unformatted text in a single cell Macro to paste unformatted text Andacar Word 2 01-05-2011 09:15 PM
Macro to write bold and unformatted text in a single cell How can I write the following (whole) formula in a single cell? Learner7 Excel 1 07-19-2010 10:06 AM

Other Forums: Access Forums

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