Jump to content
Sign in to follow this  
Medic873

Excell Attatch

Recommended Posts

Medic873

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

Share this post


Link to post
Share on other sites
enaiman

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 :)

Share this post


Link to post
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
Sign in to follow this  

×