LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Invalid Procedure Call Or Argument with VBScript

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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CreatePivotTable: Invalid procedure call or argument DesertCyclist Excel Programming 4 October 15th 10 03:53 PM
Invalid procedure call or argument error Patrick Simonds Excel Programming 1 August 12th 06 11:40 PM
Invalid Procedure call or argument T De Villiers[_58_] Excel Programming 1 July 25th 06 03:01 PM
Run-time error '5': Invalid Procedure Call or Argument Nikila Excel Discussion (Misc queries) 2 February 24th 06 09:26 PM
Run-time error '5':Invalid Procedure call or argument Jan Refsdal Excel Programming 1 July 25th 03 05:14 AM


All times are GMT +1. The time now is 04:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"