Results 1 to 2 of 2
  1. #1
    baba is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    43

    Copy After works only for the first time and works again after reopening the Access DB

    The below code works fine only for the first time and when I try to rerun, it is not copying the sheets from source to destination. If I close the MsAccess DB abd then reopen and execute it works again. Looks like some initialization problem. Can some one help me




    Code:
    Dim x, i As Integer
    x = 1
    Wkb1.Activate
    Dim CurSheet As String
    
    CurSheet = Wkb1.ActiveSheet.Name
    
    Do While x < RecordCount
    Sheets(CurSheet).Activate
    ActiveSheet.Copy after:=Sheets(Sheets.Count)
    
    ActiveSheet.Name = "Sheet" & x
    
    x = x + 1
    Sheets(CurSheet).Activate
    Loop

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 08-22-2014, 09:30 AM
  2. Replies: 2
    Last Post: 01-15-2014, 03:50 PM
  3. Replies: 2
    Last Post: 06-28-2013, 10:14 AM
  4. Setfilter works in Access but not Sharepoint
    By estroud in forum SharePoint
    Replies: 1
    Last Post: 05-28-2012, 12:55 PM
  5. Replies: 11
    Last Post: 04-04-2010, 07:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums