Solved

VBscript ability to control formatting?

Posted on 2016-10-12
2
26 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:sagardeo
2 Comments
 
LVL 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 150 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 26

Accepted Solution

by:
MacroShadow earned 350 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now