ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Default formatting settings (https://www.excelbanter.com/excel-programming/312650-default-formatting-settings.html)

Stef

Default formatting settings
 
My application adds new worksheets to an open workbook to perform separate
calculations. These worksheets are formatted programmatically, containing
e.g. comboboxes. To ensure correct layout the standard font should be Arial,
size=11. I want to make sure that all users have this setting as default when
they work with this application. I tried this, but without success though:

With Application
.StandardFont = "Arial"
.StandardFontSize = "11"
End With

I put this code on the OK button on a form that adds a new sheet.
--
Stef

kkknie[_209_]

Default formatting settings
 

Directly after you add the new sheet in your code, you could just use:

Cells.Font.Name = "Ariel"
Cells.Font.Size = 11

to format the sheet.



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26683


keepITcool

Default formatting settings
 
your solution just sets it for each new workbook created
after your apply the settings.

For existing workbooks following would probably work ok.

Sub ResetFont()
With ActiveWorkbook
Dim ws
With .Styles("Normal").Font
.Name = "Arial"
.Size = 11
End With
For Each ws In .Worksheets
ws.UsedRange.Font.Name = "Arial"
'leave sizes intact..
Next
End With

End Sub


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"?B?U3RlZg==?=" wrote:

My application adds new worksheets to an open workbook to perform
separate calculations. These worksheets are formatted
programmatically, containing e.g. comboboxes. To ensure correct layout
the standard font should be Arial, size=11. I want to make sure that
all users have this setting as default when they work with this
application. I tried this, but without success though:

With Application
.StandardFont = "Arial"
.StandardFontSize = "11"
End With

I put this code on the OK button on a form that adds a new sheet.




All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com