|
Prev: Verifying IIS certificates
Next: Editing extended Active Directory user's informations with VBS
From: XP on 21 Jul 2008 14:41 I have an Excel File open and have performed some functions on it. Now I want to get a reference to this file and close it without saving changes by feeding the file name to a function, but this doesn't work; can someone please correct it for me? Function FileCloseXLSNoSave(argFileName) Set oXL = GetObject("", "Excel.Application") Set oWB = oXL.Workbooks.Close argFileName, False Set oWB = Nothing Set oXL = Nothing End Function Thanks much in advance.
From: Luuk on 21 Jul 2008 15:00 XP schreef: > I have an Excel File open and have performed some functions on it. Now I want > to get a reference to this file and close it without saving changes by > feeding the file name to a function, but this doesn't work; can someone > please correct it for me? > > Function FileCloseXLSNoSave(argFileName) > Set oXL = GetObject("", "Excel.Application") > Set oWB = oXL.Workbooks.Close argFileName, False > Set oWB = Nothing > Set oXL = Nothing > End Function > > Thanks much in advance. Set oXL = GetObject("", "Excel.Application") wscript.echo oXL.Workbooks.count Set oXL = Nothing returns "0" to me, even if i have a file open in Excel, so i think this is the wrong way to solve your problem, but i'm not an expert in vbscript ..... ;-) -- Luuk
From: XP on 21 Jul 2008 16:06 After much experimentation, I solved it using my method. Thanks. "XP" wrote: > I have an Excel File open and have performed some functions on it. Now I want > to get a reference to this file and close it without saving changes by > feeding the file name to a function, but this doesn't work; can someone > please correct it for me? > > Function FileCloseXLSNoSave(argFileName) > Set oXL = GetObject("", "Excel.Application") > Set oWB = oXL.Workbooks.Close argFileName, False > Set oWB = Nothing > Set oXL = Nothing > End Function > > Thanks much in advance.
|
Pages: 1 Prev: Verifying IIS certificates Next: Editing extended Active Directory user's informations with VBS |