Search the Community
Showing results for tags 'excel links'.
-
Openning an Excel Workbook without updating links
willichan posted a topic in AutoIt Example Scripts
I have seen some threads where others have been looking for the ability to open an Excel workbook, and not be prompted about updating the linked data. I had need of this myself, so below is a modified version of _Excel_BookOpen() from the Excel UDF that will not prompt, and will allow you script to continue unimpeeded by linked data. You will still need to #Include <Excel.udf> to use this ; #FUNCTION# ==================================================================================================================== ; Author ........: SEO <locodarwin at yahoo dot com> ; Modified.......: litlmike, water, GMK, willichan ; =============================================================================================================================== Func _Excel_BookOpen_NoUpdate($oExcel, $sFilePath, $bReadOnly = Default, $bVisible = Default, $sPassword = Default, $sWritePassword = Default) If Not IsObj($oExcel) Or ObjName($oExcel, 1) <> "_Application" Then Return SetError(1, @error, 0) If Not FileExists($sFilePath) Then Return SetError(2, 0, 0) If $bReadOnly = Default Then $bReadOnly = False If $bVisible = Default Then $bVisible = True ;; changing the second parameter on the following line to a 0 tells Excel not to update any links. Local $oWorkbook = $oExcel.Workbooks.Open($sFilePath, 0, $bReadOnly, Default, $sPassword, $sWritePassword) If @error Then Return SetError(3, @error, 0) $oExcel.Windows($oWorkbook.Name).Visible = $bVisible ; If a read-write workbook was opened read-only then return an error If $bReadOnly = False And $oWorkbook.Readonly = True Then Return SetError(4, 0, $oWorkbook) Return $oWorkbook EndFunc ;==>_Excel_BookOpen_NoUpdate Valid alternate values are: 0: Don't update any references 1: Update external references, but not remote references 2: Update remote references, but not external references 3: Update both remote and external references- 10 replies
-
- excel links
- excel
-
(and 1 more)
Tagged with: