MartyConnelly
martyconnelly at shaw.ca
Tue Sep 12 18:43:53 CDT 2006
Let's see the intermediate code. Billy Pang wrote: >Thanks Marty and may the force be with you. I tried the different >copy method but I still get the same result (error message). >However, I noticed that the excel app still exists after I destroyed it. >That is... > > Dim xlApp As Excel.Application > Set xlApp = CreateObject("Excel.Application") > > some code for adding data to the the worksheet > some code for copying the worksheet > xlApp.Quit > Set xlApp = Nothing > >(that is, after stepping through set xlApp = nothing, I can still see >Excel.exe in my windows task manager) > >However, if I remove the code that copies the worksheet, excel.exe is >properly removed after set xlApp = nothing. > >Billy > >On 9/12/06, MartyConnelly <martyconnelly at shaw.ca> wrote: > > >>Use the Object Browser Luke! >>There is more than one copy method >>or it maybe you haven't set the activesheet >>in your method >> >>Sub CopyAndName() >>' This creates a new sheet, >>' copies the data from the first sheet, >> >>Dim sName As String, sht1 As Worksheet, sht2 As Worksheet >>Set sht1 = ActiveSheet >>Set sht2 = Worksheets.Add(after:=ActiveSheet) >>sht2.Name = "MyNewName " >>sht1.UsedRange.Copy Destination:=sht2.Range("A1") >>End Sub >> >> >>Billy Pang wrote: >> >> >> >>>Hello: >>> >>>>From Access, I'm trying to make a copy of a worksheet within an instance >>> >>> >>of >> >> >>>Excel that is created at runtime in VBA. >>> >>>xlsheet.copy after:=activesheet >>> >>>However, I get the following error message. >>> >>>Run-time error '5' >>> >>>Invalid procedure call or argument >>>Any ideas? >>> >>>Many thanks in advance, >>>Billy >>> >>> >>> >>> >>> >>-- >>Marty Connelly >>Victoria, B.C. >>Canada >> >>-- >>AccessD mailing list >>AccessD at databaseadvisors.com >>http://databaseadvisors.com/mailman/listinfo/accessd >>Website: http://www.databaseadvisors.com >> >> >> > > > > > -- Marty Connelly Victoria, B.C. Canada