Excel.....again...again...again

See my code below: GLEntry.SETCURRENTKEY(“G/L Account No.”,“Business Unit Code”,“Department Code”,“Project Code”,“Posting Date”); GLEntry.SETFILTER(“G/L Account No.”,‘61100…61300’); CREATE(xlApp); xlBook := xlApp.Workbooks.Add(-4167); xlSheet := xlApp.ActiveSheet; xlSheet.Name := ‘Personnel Expenses’; GLEntry.SETRANGE(“Department Code”,‘ADM’); GLEntry.CALCSUMS(Amount); xlSheet.Range.Columns.Autofit; xlSheet.Range(‘A2’).Value := ‘Administration’; xlSheet.Range(‘A3’).Value := GLEntry.Amount; GLEntry.SETRANGE(“Department Code”,‘PROD’); GLEntry.CALCSUMS(Amount); xlSheet.Range(‘B2’).Value := ‘Production’; xlSheet.Range(‘B3’).Value := GLEntry.Amount; GLEntry.SETRANGE(“Department Code”,‘SALES’); GLEntry.CALCSUMS(Amount); xlSheet.Range(‘C2’).Value := ‘Sales’; xlSheet.Range(‘C3’).Value := GLEntry.Amount; xlApp.Visible := TRUE; It is code directly from the 2.60F CD. It works fine except for the one line i added: xlSheet.Range.Columns.Autofit; It will not even compile. I saw similar code in the forum when I searched for Excel examples. All I am trying to do is have each column autofit.

Hi Bill

quote:


Originally posted by wbenefiel
… xlSheet.Range.Columns.Autofit; xlSheet.Range(‘A2’).Value := ‘Administration’; xlSheet.Range(‘A3’).Value := GLEntry.Amount; …


Without testing: You might select a range to format. Try something like this:


 xlSheet.Range('A:D').Columns.Autofit;

bye Andre

Hi Andre thanks, it worked great. At first it didn’t seem to but, after I moved it to the bottom of my code, just before the visible it did. [:)] By the way, if no human was used to create your message, then what are you? [:D]

Hi Bill

quote:


Originally posted by wbenefiel
By the way, if no human was used to create your message, then what are you? [:D]


I found this on the bottom of the new Google-News - page. The original text was:

quote:


No humans were harmed or even used in the creation of this page.


I thought: Hey, this is a cool disclaimer [:D]. If a posting of me is wrong, I could say, this posting isn’t from me, it is an automatic posting from my Navision [;)]. btw. Google had changed the disclaimer to:

quote:


This page was generated entirely by computer algorithms without human editors.


bye Andre