Highlighted
Absent Member.
Absent Member.
553 views

[archive] Excel stays in memory

[Migrated content. Thread originally posted on 25 January 2006]


           CREATE APPLICATION OF Excel HANDLE IN olExcel.
           MODIFY olExcel Workbooks::Add() GIVING olWrkBk.
           INQUIRE olWrkBk Worksheets::Item(1) IN olWrkSh.
     
           ......

           INQUIRE olWrkSh @Range("A1:H1000") IN olRange.
           MODIFY olRange @Font::Name = "Small Fonts",
                          @Font::Size = 6.

           ......

           DESTROY olRange.
           DESTROY olWrkSh.
     
           MODIFY olWrkBk @SaveAs(BY NAME @Filename WBESTAND)
           MODIFY olWrkBk @Close(BY NAME SaveChanges 0).
           DESTROY olWrkBk.
           MODIFY olExcel Quit().
           DESTROY olExcel.



Using this code, everything works just fine except for Excel to stay in memory.

Any ideas what can be forgotten ?
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Excel stays in memory

If you type offer the source and d'nt make a mistake, then I think the solutions is @ before quit.

Tel us the result.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Excel stays in memory

With MODIFY olExcel @Quit(), I don't see any changes.
Excel just stays in memory.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Excel stays in memory

Originally posted by Hans

...


Using this code, everything works just fine except for Excel to stay in memory.

Any ideas what can be forgotten ?


Chances are, a dialog box pops up. Try to execute with VISIBLE = 1 and see if this is the case.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Excel stays in memory

This is the routine I use. Even with VISIBLE = 1, Excel stays in memory.

      *
       CREATE-EXCEL-FILE.
           PERFORM CREA-EXCEL00 THRU CREA-EXCEL99.
       CREA-EXCEL00.
           CREATE APPLICATION OF Excel HANDLE IN olExcel.
           MODIFY olExcel Workbooks::Add() GIVING olWrkBk.
           INQUIRE olWrkBk Worksheets::Item(1) IN olWrkSh.
     
      * Tabel in Excel plaatsen
           MODIFY olWrkSh Range("A2")::Resize(TELLER, 8)::Value =
                  EXCEL-TABEL.

      * Kolommen verbreden
           MODIFY olWrkSh @Range("A1")::ColumnWidth = 24,
                          @Range("B1")::ColumnWidth = 24,
                          @Range("C1")::ColumnWidth = 3,86 ,
                          @Range("D1")::ColumnWidth = 15,14 ,
                          @Range("E1")::ColumnWidth = 8 ,
                          @Range("F1")::ColumnWidth = 8 ,
                          @Range("G1")::ColumnWidth = 9 ,
                          @Range("H1")::ColumnWidth = 51,57.

      * Font naar Arial 8
           INQUIRE olWrkSh @Range("A1:H1000") IN olRange.
           MODIFY olRange @Font::Name = "Small Fonts",
                          @Font::Size = 7.

      * Pagina Setup
           MODIFY olWrkSh @PageSetup::TopMargin    = 0,
                          @PageSetup::BottomMargin = 0,
                          @PageSetup::LeftMargin   = 0,
                          @PageSetup::RightMargin  = 0,
                          @PageSetup::Orientation  = xlLandscape.

      * Font & kleur & kader hoofding veranderen
           INQUIRE olWrkSh @Range("A1:H3") IN olRange.
           MODIFY olRange @Font::Bold = 1.
           MODIFY olRange @Interior::ColorIndex = 15.
           MODIFY olRange @Interior::Pattern = @xlSolid.
           MODIFY olRange @BorderAround(@xlContinuous, @xlThin,
      -                       @xlColorIndexAutomatic).

      * Formaat kolom G veranderen
           INQUIRE olWrkSh @Range("G1") IN olRange;
           MODIFY olRange @ENTIRECOLUMN::@NUMBERFORMAT('###.###.##0,00').

      * Kolom E, F, G rechts uitlijnen
           INQUIRE olWrkSh @Range("E3:G3") IN olRange;
           MODIFY olRange @HorizontalAlignment=xlHAlignRight.

      * Hoofding in ander kleur zetten
           INQUIRE olWrkSh @Range("A1:H3") IN olRange
           MODIFY olRange @Font::ColorIndex = 9
           MODIFY olRange @Font::Bold = 1

           DESTROY olRange.
           DESTROY olWrkSh.
     
           MODIFY olWrkBk @SaveAs(BY NAME @Filename WBESTAND)
           MODIFY olWrkBk @Close(BY NAME SaveChanges 0).
           DESTROY olWrkBk.
           MODIFY olExcel @Quit().
           DESTROY olExcel.
       CREA-EXCEL99.
      *

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Excel stays in memory

You do get a whole lot of olRange wich you simply overwrite. I suggest you may try to destroy the ranges before you get a new one into the same variable.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Excel stays in memory

Thanks Ghisle, that's the trick.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.