Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Horizontal Alignment in Excel?
Message
From
15/07/2009 07:32:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
14/07/2009 21:54:14
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01412369
Message ID:
01412455
Views:
74
>Somehow I'm still not getting it right.
>
>My object for Excel is "oleapp". I have to be able to reference the range based on the fact that I know it's column A in the worksheet, but, the row (m.rownbr) will change depending on when I've reached the end of the file. Then JUST that cell needs to left align, since the rest of the information in the A column is set to automatically center.
>
>Thanks for your attention and help.
>
>m

Since you are asking such specific questions, about alignment, I assume you have already done some basic automation before. Anyway, you need some reference to a cell, or to a spreadsheet. The spreadsheet reference can be obtained from the Excel object. Here is the sample code from my article:
local oExcel, oSheet
oExcel = CreateObject("Excel.Application")
oExcel.Visible = -1   && for debugging
oExcel.Workbooks.Add()
oSheet = oExcel.ActiveSheet
oSheet.Cells(1,1).Value = "Hello, World!"
Once you come this far, you can manipulate any individual cell (or range of cells - also explained in my article on Excel Automation). The usual way to do this is to save a macro, and adapt to Visual FoxPro syntax - mainly, change some object references to oSheet in the above example.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform