+ Reply to Thread
Results 1 to 5 of 5

VBA Excel Borders linestyle - works first time - not second time

  1. #1
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    VBA Excel Borders linestyle - works first time - not second time

    My code is in Access 2003 VBA.
    It creates an Excel application - the report data (formula is perfect)
    Wondering if passing the excel objXL (created in click event) is the problem?
    At the end of the Access form, all objects (included objXL) are set to Nothing

    Funny, it accuratelly puts values and formula's in the cells.
    - The first time through, it also puts a border around each cell with a value.
    - The second and more times, it just ignores only the borders.
    - every thing is fine, just the borders the second, third and beyond times.
    Rebooting the PC; the borders work fine the the first run.

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: VBA Excel Borders linestyle - works first time - not second time

    Calling Excel application object from Access vba.
    Using the Task Manager, I notice that a second instance of Excel is created. It does not have an interface. It does not close when I stop the form.
    My suspicition is that it is orphaned.
    The next time I run the application, it must be playing a role.

    It is strange.
    The code before and after the border format actually works.
    The border code does not work, but the code right after does work.
    I will post what I find.

    My plan is to leave task manager open and step through my code and see when the second instance of Excel is created.

  3. #3
    Registered User
    Join Date
    03-05-2009
    Location
    Vail, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    83

    Re: VBA Excel Borders linestyle - works first time - not second time

    Solution:
    Traced from begin to end of code.
    The code is 20 pages of Excel VBA, T-SQL, and Access SQL calls for a custom dynamic report with multiple loops and remote function calls.

    Found a instance where Excel Object was passed into a function for a programming reference, exited as expected, and the object reference was not destroyed.

    I am looking on how to mark this tread as SOLVED.
    Thanks!

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: VBA Excel Borders linestyle - works first time - not second time

    I am looking on how to mark this tread as SOLVED.
    Forum Rules
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    07-11-2014
    Location
    Coimbatore, India
    MS-Off Ver
    2010
    Posts
    5

    Re: VBA Excel Borders linestyle - works first time - not second time

    I hope this thread is still alive..

    RxMiller: Same problem here. How do you destroy the object reference?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1