Results 1 to 3 of 3

Thread: Ms Access 2003 Issue

  1. #1
    Join Date
    Mar 2009
    Posts
    1

    Ms Access 2003 Issue

    Hello all,

    I have a module that deletes data in excel closes then Access imports then exports data to excel. When I try to run it a second time I get the following Error........runtime error '1004' Method 'Sheets' of object'_Global' failed.........i noticed that the Excel.exe stays active in Task Manager, is there a way form me to completely close out excel. Below is my code for the delete portion of my macro.

    Function MW_Erase_DB_Results()
    Dim appexcel As Object
    Set appexcel = CreateObject("Excel.Application")
    appexcel.Workbooks.Open "Z:\Call Aheads\Call_Ahead_Results\MW_Call_Ahead_Stats.xls"
    appexcel.Visible = True

    Sheets("DB_Results").Select
    Cells.Select
    Selection.Delete Shift:=xlUp
    Range("A1").Select
    Sheets("Projections").Select
    Range("A4").Select
    ActiveWorkbook.Save
    ActiveWindow.Close

    End Function

    - - - - - - - - - - - -

    thank you in advace!

    E

  2. #2
    Join Date
    Dec 2007
    Posts
    1,736

    Re: Ms Access 2003 Issue

    This line is within the error handler. So, the actual error happens at line 99 (?). Check what error is raised there. It may be that the sheet gets protected after you first run of sub (line 101) and it siesn' get unprotected before you try to paste data for the 2nd time.

    P.S. I assume that you have a "managed" error, i.e., you use the error handler to check object exsitance (I may be wrong). Then I would recommend to use "on error resume next" statement, it is better not to iteract with objects in the handler, in case the same error may happen. You also don't have to call Err.

  3. #3
    Join Date
    Aug 2007
    Posts
    1,098

Similar Threads

  1. Read Access 2003 files with Access 2007
    By Kendal-J in forum Windows Software
    Replies: 2
    Last Post: 26-05-2010, 05:57 PM
  2. SBS 2003 Remote Access Strange ISSUE
    By Opideousneo in forum Operating Systems
    Replies: 2
    Last Post: 07-03-2009, 06:11 PM
  3. Files Access issue after putting in Access Rights
    By Simon Gronow in forum Windows Server Help
    Replies: 4
    Last Post: 30-01-2009, 07:23 AM
  4. Robocopy - Access Denied issue - migration from 2003 to 2008
    By Brian Brocker in forum Windows Server Help
    Replies: 2
    Last Post: 12-11-2008, 08:26 PM
  5. VPN Remote Access Issue - Can Login, but can't access local resour
    By PARRISH in forum Small Business Server
    Replies: 2
    Last Post: 14-05-2008, 03:09 PM

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
  •  
Page generated in 1,717,389,022.96457 seconds with 16 queries