Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I'm using VBScript to open an Excel document provided by a user and exporting a gridview's contents to that Excel document. This process works flawlessly on the first export, but if the user saves the resulting Excel document, they can NEVER again use for an export from this intranet website. The code I'm using to export is: Dim sHTML, oXL, oBook, oBook2, STHML2 Set oXL = Nothing Set oBook = Nothing Set oXL = CreateObject("Excel.Application") dim filePath filePath = document.all.item("ctl00_ContentPlaceHolder1_Tabs_ tpExport_fuTemplate").value sHTML = document.all.item("ctl00_ContentPlaceHolder1_resul tGrid").outerhtml Set oBook = oXL.Workbooks.Open(filePath) oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML oBook.HTMLProject.RefreshDocument 'oXL.Visible = true 'oXL.UserControl = true oXL.Quit() I've purposely left out the oXL.Visible = True and oXL.UserControl = True lines so that the user is not presented with the resulting Excel document automatically...but this does not change the outcome. Another odd aspect is that if you use Set oBook = oXL.Workbooks.Add(filePath) when the user goes to save the resulting Excel document he is given a save dialog with the provided filePath with a '1' appended to the end. If this document is saved, the user can then proceed to save to the ORIGINAL filePath without incident. Thanks in advance for any assistance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
CreatePivotTable: Invalid procedure call or argument | Excel Programming | |||
Invalid procedure call or argument error | Excel Programming | |||
Invalid Procedure call or argument | Excel Programming | |||
Run-time error '5': Invalid Procedure Call or Argument | Excel Discussion (Misc queries) | |||
Run-time error '5':Invalid Procedure call or argument | Excel Programming |