Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GetObject problem
Message
From
17/07/2001 09:26:37
 
 
To
16/07/2001 13:38:56
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00531112
Message ID:
00531485
Views:
12
>I have a function that put data in an excel file. The first time the program access this function, It use the CreateObject method and the other times, It use the GetObject one. But this is not working. Do you have an idea why? Here is the code of the function:
>
>Set application = CreateObject("Excel.Application")
>
>if ecriture = 1 Then
> Set fichier = CreateObject("Excel.Sheet")
>else
> Set fichier = GetObjec("M:\DACE\PROJET_DMS\Test\test.xls","Excel.Sheet")
>end if
>
>
>fichier.ActiveSheet.Cells(ecriture,1).Value = valeur
>fichier.ActiveSheet.Cells(ecriture,2).Value = annee
>
>fichier.SaveAs "M:\DACE\PROJET_DMS\Test\test.xls"
>
>
>fichier.Application.Quit
>Set fichier = Nothing


Hi there,

Where in this function are you setting the value of "ecriture" so it knows which section of the IF-THEN-ELSE to fall in to?

Also, since you are releasing the "fichier" object on each pass through the function with the "Set fichier = Nothing", just use the CreateObject() function, as the previous Excel.Sheet object is no longer in memory. GetObject serves no purpose here.
Phil
_____________________________
Phil Miles
http://www.philmiles.com
phil@philmiles.com
Previous
Reply
Map
View

Click here to load this message in the networking platform