Jump to content

Excell Attatch


Recommended Posts

When ever I try to attach to any excel workbook it keeps giving me a error messgae. Error 191

#include <Excel.au3>
#include <File.au3>

$sFilePath = @TempDir & "\Temp.xls"
If Not _FileCreate($sFilePath) Then ;Create an .XLS file to attach to
    MsgBox(4096, "Error", " Error Creating File - " & @error)
EndIf

_ExcelBookOpen($sFilePath)
$oExcel = _ExcelBookAttach($sFilePath) ;with Default Settings ($s_mode = "FilePath" ==> Full path to the open workbook)
_ExcelWriteCell($oExcel, "If you can read this, then Success!", 1, 1) ;Write to the Cell
MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookClose($oExcel, 1, 0) ;This method will save then Close the file, without any of the normal prompts, regardless of changes

dose anyone know how to use this.

Thank You

Link to comment
Share on other sites

Can you specify what fails exactly? Also, I have one script which intensively uses Excel files but I never use _ExcelBookAttack -- to my knowledge you can just use _ExcelBookOpen and use the returned handle. Isn't _ExcelBookAttach used when Excel is already running? Please correct me when I'm wrong :mellow:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...