Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Formatting ...
Message
 
 
To
09/10/2001 16:56:40
Melvin Sequera
M&H New World, C.A.
Fuenlabrada, Spain
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00566207
Message ID:
00566413
Views:
11
>I mean I create an object Excel.Application and put some values in there, but now I want to change the font of a column and maybe bold that column too. Anybody, please, can tell me how can I do that?

Hilmar Zonneveld had a great idea: record a macro and convert it to VFP. It's not that difficult, and there's a good MS Knowlege Base article on the topic.

However, sometimes seeing example code is nice, too. Here are some examples:

Increase column width by 2
oExcel.ActiveSheet.Columns[2].ColumnWidth =.ColumnWidth + 2
Change the alignment of a range of cells (other constants are available):
#DEFINE xlHAlignCenter -4108
oSheet.Range("A5:C5").HorizontalAlignment = xlHAlignCenter
When you record a macro, you'll see a ton of constants. For information on how to find the values of those constants so you can define them, see the very last question on this page: http://www.hentzenwerke.com/catalogavailability/autofoxfaq.htm

Change the font to bold, 14 pt, Times New Roman for a single cell:
WITH oSheet.Range("B2").Font
  .Name = "Times New Roman"
  .Size = 14
  .Bold = .T. 
ENDWITH
Hope this helps,

- della
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform