Solved

VBscript ability to control formatting?

Posted on 2016-10-12
2
41 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 27

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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

831 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