Solved

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

Posted on 2014-03-10
2
568 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
Comment Utility
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
Comment Utility
Thanks very much
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

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…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
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…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

771 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

13 Experts available now in Live!

Get 1:1 Help Now