Medic873 Posted July 9, 2010 Share Posted July 9, 2010 I have never been able to get the excel attach function to work please help What I need is for my software to attach to the open excel work book. I want it to attach by the title of course being "Microsoft Excel - Book1" I have looked in the help file and cant get this to work please help Link to comment Share on other sites More sharing options...
enaiman Posted July 9, 2010 Share Posted July 9, 2010 Did you try all 3 examples? Two of them didn't work for me but the 3rd did. With a minimum modification; here is the code: #include <Excel.au3> #include <File.au3> $sFilePath = @TempDir & "\Book1.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) _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 ... just basic stuff - really. For the future stop being so lazy. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now