Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Autoformation in Excel (Individual cells alignment)
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Network:
Windows 2000 Pro
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01185017
Message ID:
01187782
Views:
26
i only got around to trying this on friday but could not get it working. roughly below i have copied some of what i tried. i did all this in the command window which does not allow with to be used. the first 5 lines work ok but everything after that fails, i get told off by excel, telling me that range does not allow this.
oleApp = CreateObject("Excel.Application")
OleApp.Visible = .T.
OleApp.WorkBooks.Add
lncounter = 3
OleApp.cells(lnCounter,3).value   = "ID"
Oleapp.Cells.HorizontalAlignment = -4107
Oleapp.Selection.HorizontalAlignment = -4107
OleApp.cells(lnCounter,3).HorizontalAlignment = -4107
on that other note, they did not let themselves down on saturday, is second place calling?
~M

>>actually terry i didn't explain what i am trying to do properly. i need to left align a few cells and i thought that it could be done through the autoformat function
>
>Example:
>
>#define xlCenter	-4108
>
>With .Selection
>  .WrapText            = .T.
>  .Orientation         =  0
>  .HorizontalAlignment = xlCenter
>EndWith
>
>
>>on another note they were some awful results against the gunners, shocking
>
>Shocking! Bloody well shell-shocking! Hang my head in shame. Liverpool are notorious for letting themselves down in a clintch - but they don't get trounced!
>
>>~M
>>
>>>>hi all,
>>>>I am trying to tidy up an excel export program that i have. it all works ok but they layout needs a couple of tweeks. i am tryng to autoformat a cell but using the code below i get the error "... because you selected only one cell and the surrounding cells are blank, MS excel cannot determine which cells to apply the autoformat to"
>>>>
>>>>OleApp.Cells(lnCounter,1).AutoFormat()
>>>>
>>>>~M
>>>
>>>Mark
>>>
>>>I'm no expert at this but I recently did some formatting, with Boris's help. Would something like:
>>>
>>>With OleApp
>>> .Range("A2:A2").Select
>>> .Selection.Autoformat
>>>EndWith
>>>
>>>work?
>>>
>>>Terry
Go raibh maith agat

~M
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform