?
Solved

VBscript ability to control formatting?

Posted on 2016-10-12
2
Medium Priority
?
52 Views
Last Modified: 2016-10-16
Can VBscript control things like formatting (bolding, adding cell borders, wrapping text on certain fields, etc.). If so, what functions are available?
0
Comment
Question by:Judy Deo
[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 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 600 total points
ID: 41841342
The broad answer is yes. VBA can do just about everything you can do manually in Excel, plus more. For specifics about formatting cells it's probably best to point you toward the official documentation of the Range object. Browse through the Properties at the bottom.

https://msdn.microsoft.com/en-us/library/office/ff838238.aspx?f=255&MSPPError=-2147217396
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 1400 total points
ID: 41841344
You probably mean VBA not VBscript which is a standalone scripting language.
The answer to your question is anything you can do using Excel's GUI can be done using VBA.
Here are some examples for formatting the font:
' set font properties
Selection.Font.Name = "Rockwell Condensed"
Selection.Font.Bold = True
Selection.Font.Italic = True
Selection.Font.Strikethrough = True
Selection.Font.Size = 45
Selection.Font.ThemeColor = 5
Selection.Font.Color = vbBlue

Open in new window

p.s. instead of selection you can (and should use the range object, i.e.
' set font properties
Range("A1").Font.Name = "Rockwell Condensed"
Range("A1:B5").Font.Bold = True
Range("A1:B5").Font.Italic = True
Range("A1:B5").Font.Strikethrough = True
Range("A1:B5").Font.Size = 45
Range("A1:B5").Font.ThemeColor = 5
Range("A1:B5").Font.Color = vbBlue

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

762 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