Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Code to format cells in Excel
Message
 
 
À
05/02/2009 15:07:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP
Divers
Thread ID:
01379609
Message ID:
01379612
Vues:
36
>Hello,
>
>I am attempting to format a cell in Excel using the following macro:
>
>Sub Macro1()
>'
>' Macro1 Macro
>' Macro recorded 2/5/2009 by Martha Kroll
>'
>
>'
> Range("A57:B57").Select &&This needs to reference (m.rownbr,1)
> With Selection
> .HorizontalAlignment = xlCenterAcrossSelection
> .VerticalAlignment = xlBottom
> .WrapText = False
> .Orientation = 0
> .AddIndent = False
> .IndentLevel = 0
> .ShrinkToFit = False
> .ReadingOrder = xlContext
> .MergeCells = False
> End With
>End Sub
>
>Obviously this doesn't work if I just copy & paste it into my code. Any suggestions as to how to make this work are greatly appreciated.
>
>Thanks,
>Martha

Something like
*-- Create Ole Automation with Excel
	loExcel = CREATEOBJECT("Excel.Application")
*-- Open XLS File
	loExcel.APPLICATION.WorkBooks.OPEN(m.tcXLSFileName)

	loExcel.DisplayAlerts = .F.

	FOR lnI = 1 TO loExcel.APPLICATION.APPLICATION.WorkBooks(1).Sheets.COUNT
*-- Select individual sheets from open XLS File
		loSheet = loExcel.APPLICATION.APPLICATION.WorkBooks(1).Sheets(m.lnI)

loSheet.RANGE(lcRange).SELECT

WITH loExcel.SELECTION
			.HorizontalAlignment = xlCenter
			.VerticalAlignment = xlBottom
			.WrapText = .F.
			.ORIENTATION = 0
			.AddIndent = .F.
			.IndentLevel = 0
			.ShrinkToFit = .F.
			.ReadingOrder = xlContext
			.MergeCells = .T.
ENDWITH
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform