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.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Active x Script

Author  Topic 

rookie_sql
Constraint Violating Yak Guru

443 Posts

Posted - 2007-05-15 : 14:22:06
Hi, with regards to working with a excel file that is password protected, can i set the password in my active x code.

**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

' UpdateExcelWorkbook
' Option Explicit

Function Main()

Dim Excel_Application
Dim Excel_WorkBook

Dim sFilename

sFilename = DTSGlobalVariables("gv_ExcelFileLocation").Value

Set Excel_Application = CreateObject("Excel.Application")

' Open the workbook specified
Set Excel_WorkBook = Excel_Application.Workbooks.Open(sFilename)

Excel_WorkBook.RefreshAll
Excel_WorkBook.Save

'Clean Up our Excel Objects
Excel_WorkBook.Close
Set Excel_WorkBook = Nothing
Excel_Application.Quit
Set Excel_Application = Nothing

Main = DTSTaskExecResult_Success
End Function
   

- Advertisement -