Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mkal
Starting Member
5 Posts |
Posted - 2003-06-20 : 16:22:48
|
| I've been trying to save an Excel workbook as a Web page by running an ActiveX Script task in DTS. The script looks like this: Function Main() Set oSSBExcel = CreateObject("Excel.Application") oSSBExcel.Workbooks.Open "C:\ssb\testssb01.xls" oSSBExcel.Visible = False oSSBExcel.Workbooks("testssb01.xls").Activate On Error Resume Next oSSBExcel.ActiveWorkbook.SaveAs "C:\ssb\testssb01.xls", xlhmtl If err.number <> 0 Then oSSBExcel.Workbooks.Save oSSBExcel.Workbooks.Close False oSSBExcel.Quit Set oSSBExcel = Nothing msgbox err.number & vbCrLf & err.description Main = DTSTaskExecResult_Failure Esle Main = DTSTaskExecResult_Success End IfThe error message I recieve is Error Number: 450 Error Description: Wrong number of arguments or invalid property assignment. I know its this line of code:oSSBExcel.ActiveWorkbook.SaveAs "C:\ssb\testssb01.htm", xlhtmlI've tried various variations like putting the arguments in () but it then says "cannot use parentheses when calling a Sub", I've also tried putting quotes around xlhtml, I've also tried passing the arguments using FileName:= C:\ssb\testssb01.htm, FileFormat:=xlhtml but all fail.I'm at a loss as to what to try next so any help or suggestions are most welcome. |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-06-20 : 17:11:39
|
| is xlhmtl defined? I know you often can't used named constants in scripts because they are usually not defined ...try finding out the actual value of xlhtml and putting in that instead.also, always use Option Explicit so that these problems never occur. can't stress that one enough.- Jeff |
 |
|
|
mkal
Starting Member
5 Posts |
Posted - 2003-06-20 : 17:35:11
|
| Thanks for the advice. I'm not having much luck with finding the value for xlhtml. I know this is a valid fileformat when used in VBA but not sure about vbscript. Ran it a couple of times passing a number instead of xlhtml. It saves the file but formatting is all messed up and I still recieve the same error message.It would appear that passing the real value instead of xlhtml might get me what I want but it still throws and exception for the syntax. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-06-20 : 18:31:41
|
| wherever you that constant it in VBA, just add the line:msgbox xlhtmland it'll tell you the value in a message box. also, you can use the object browser to get the values of enumerated constants.- Jeff |
 |
|
|
mkal
Starting Member
5 Posts |
Posted - 2003-06-23 : 10:00:27
|
| Hi Jeff,That was soooo obvious after you said it not to mention that it also worked. Interesting side note though, the ActiveX Script task returned: "1 (task(s) failed during execution." and none of the inline error handling fired.How can it save the file, fail the task and skip the error handling??There's something odd about the way DTS is doing this.Again thanks for the help!Mike |
 |
|
|
|
|
|
|
|