Solved

VB.net Excel Add-n Using Font Dialog to format a  cell

Posted on 2014-03-10
2
572 Views
Last Modified: 2014-03-10
Hi/ I am using FontDialog to capture information about an Excel cell that I will be using later.
How do I actually format the cell using this information.
I tried  Globals.ThisAddIn.Application.ActiveCell.Font = FontDialog1.Font
but get an error saying that the font is ReadOnly


                Dim FontName As String = FontDialog1.Font.Name
                Dim FontStyle As String = FontDialog1.Font.Style.ToString
                Dim FontSize As String = FontDialog1.Font.Size.ToString
                Dim FontColorARGB As String = Me.FontDialog1.Color.A & ";" _
                                          & Me.FontDialog1.Color.R & ";" & _
                                          Me.FontDialog1.Color.G & ";" & _
                                          Me.FontDialog1.Color.B
0
Comment
Question by:murbro
2 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 39917505
You can't just assign a Font object - you have to set each of the properties you want individually:
With Globals.ThisAddIn.Application.ActiveCell.Font
.Name = FontName
 .FontStyle = FontStyle
                .Size = CLng(FontSize)
 .Color = RGB(Me.FontDialog1.Color.R, Me.FontDialog1.Color.G ,Me.FontDialog1.Color.B)
End With

Open in new window


or something along those lines.
0
 

Author Closing Comment

by:murbro
ID: 39917754
Thanks very much
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Basic Excel DataEntry for Dashboard analysis 3 25
Office 2016 without internet 6 36
locking multiple column ranges 10 23
Excel Question 17 15
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
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 …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

776 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