Results 1 to 5 of 5
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Automation issue (A97/XL2002)

    Try using <font face="Georgia">dteFileDate = .ActiveCell.Formula</font face=georgia> instead of <font face="Georgia">dteFileDate = ActiveCell.Formula</font face=georgia>, and <font face="Georgia">.Quit</font face=georgia> (just once) instead of <font face="Georgia">.Application.Quit</font face=georgia> (twice)

  2. #2
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel Automation issue (A97/XL2002)

    I am trying to open an Excel application, then a workbook, then get data from the workbook, then close the workbook and then close Excel.

    When my code is done running, Excel still shows in my task list.

    Any ideas what is going on?

    Morgan
    <pre>Sub ImportNewReport()
    'Used to import the daily report
    Dim strFileToImport As String
    strFileToImport = "Cocuments and Settingsmerick01.AD" & _
    "DesktopPLP ProjectsToImport1121Daily PLP Team Projects.xls"

    'Open the excel report for importing

    Dim objXL As Excel.Application
    Set objXL = New Excel.Application
    With objXL
    .Visible = False
    .Workbooks.Open strFileToImport
    .Range("A2").Select
    Dim dteFileDate As Date
    dteFileDate = ActiveCell.Formula

    MsgBox dteFileDate



    .Workbooks.Close
    .Application.Quit
    .Application.Quit
    End With

    Set objXL = Nothing
    End Sub</pre>

    Edited by HansV to break extremely long line that caused scrolling.
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  3. #3
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Automation issue (A97/XL2002)

    OK, what gives?

    I changed .Application.Quit to .Quit and nothing happened.

    I changed ActiveCell.Formula to .ActiveCell.Forumla and now Excel quits as it should....

    Sign me confused!!!
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  4. #4
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Newtown, Pennsylvania, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Automation issue (A97/XL2002)

    Shouldn't it be ObjXL.Quit? I have that in some code of mine that works ...

    If not, then I will have to learn something else!

    kiwi44

  5. #5
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel Automation issue (A97/XL2002)

    If I weren't using WITH it would be objXL.Quit
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

Posting Permissions

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