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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-14 : 10:06:20
|
M8 writes "I am trying to export data to an excel file and naming the file accordingly to the latest date(contained in one of the cells in excel sheet)
I have written a DTS script, when it is executed manually on the server, it runs fine, but through the scheduler and invoking it manually on a client pc it fails saying createobject permission denied. the code looks like:
Dim tempString Dim rownumber Dim StrSaveString dim savename 'create excel objects Dim xlApp Dim xlBook
'create new instance of excel Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.Workbooks.Add 'set excel visible during runtime xlApp.Visible = False
Function Main()
xlapp.Workbooks.Open "c:\EKU.CSV" xlapp.Cells.Select xlapp.Selection.Copy xlapp.Workbooks.Add xlapp.ActiveSheet.Paste xlapp.Selection.Columns.AutoFit xlapp.Range("B2").Select xlapp.ActiveWindow.FreezePanes = True
StrSaveString = xlapp.activesheet.cells(2,31) savename = right(StrSaveString,4)
xlapp.columns("AE:AE").select xlapp.selection.clearcontents xlapp.ActiveSheet.Name = StrSaveString xlapp.ActiveSheet.SaveAs ("w:\eu_reports\EKU"&savename& ".xls") xlapp.quit
'***clean up objects******** Set xlApp = Nothing Set xlBook = Nothing
Main = DTSTaskExecResult_Success
End Function
would anyone know a way around this??
thanks to everyone who has taken time to read this." |
|
|
|
|
|