Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Peter Bossenger
  Where is Peter Bossenger?
 Cape Town
 South Africa
 Peter Bossenger
 To: Jonathan Bossenger
  Where is Jonathan Bossenger?
 Cape Town
 South Africa
 Jonathan Bossenger
 Tags
Subject: RE: Excel Formating - Jonathan, please phone your
Thread ID: 44429 Message ID: 52707 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: Microsoft Office Automation
Date: Friday, October 1, 2004 10:08:59 PM         
   


> > > if anyone could help, it would be greatly appreciated. i have garnered some knowledge off this site on how to format an excel sheet. now i am up against a problem
> > > below is my code.
> > >
> > >
> > > SET SAFETY OFF
> > >
> > > LOCAL oExcel AS Excel.Application
> > > LOCAL oWorkBook AS Excel.Workbook
> > > LOCAL oSheet as EXCEL.Worksheet
> > >
> > > oExcel = NEWOBJECT("Excel.Application")
> > > oExcel.Visible = .T.
> > > oWorkBook = oExcel.Workbooks.Open( "workbookpath" )
> > > oSheet = oWorkbook.Worksheets("worksheetname")
> > > oSheet.Activate
> > > oSheet.Select
> > >
> > > FOR nCount = 1 TO 8
> > > osheet.Columns(nCount).EntireColumn.AutoFit
> > > LOOP
> > > ENDFOR
> > >
> > > * this is where i get the error
> > >
> > > WITH osheet.Columns(8).EntireColumn
> > > .HorizontalAlignment = "xlCenter"
> > > ENDWITH
> > >
> > > oWorkBook.SaveAs("newworkbookpath")
> > > oExcel.Quit()
> > >
> > > SET SAFETY ON
> > >
> > >
> > > my problem occurs when i attempt to center align column 8. I get a "OLE IDispatch exception code from ?:?..." error message.
> > > any ideas.
> > >
> > > thanks
> > > jonathan
> > > "This is the coolest thing I have ever seen"
> >
> >
> > Have you defined xlCentre at the start of your program?
> >
> > #DEFINE xlCentre -4108
> >
> >
> > Jez
> > (A lie will be around the world before the truth has got its boots on)
>
>
> many thanks.
> where would i go to learn this kind of thing (web site ?)
>
>
> "This is the coolest thing I have ever seen"


Peter

ENTIRE THREAD

Excel Formating Posted by Jonathan Bossenger @ 6/10/2004 6:31:02 AM
RE: Excel Formating Posted by Jez Enefer-Mills @ 6/10/2004 10:07:06 AM
RE: Excel Formating Posted by Jonathan Bossenger @ 6/10/2004 1:31:40 PM
RE: Excel Formating Posted by Jez Enefer-Mills @ 6/10/2004 4:17:23 PM
RE: Excel Formating Posted by Andy Rice @ 6/10/2004 11:56:44 PM
RE: Excel Formating - Jonathan, please phone your Posted by Peter Bossenger @ 10/1/2004 10:08:59 PM
RE: Excel Formating - Jonathan, phone me @ 4003799 Posted by Peter Bossenger @ 10/1/2004 10:10:38 PM