Jump to content
Sign in to follow this  
meatsack

$sCellValue variable not storing data

Recommended Posts

meatsack

Perplexed by why the $sCellValue variable is failing to store any data. I tried numbers and text. I double checked my test.xls file to make sure it had data. Is Excel security blocking the script for getting in? I am using msgbox for debugging purposes. I would delete it in the scripts final version. Thanks for any help.

;
;##################################
; Include
;##################################
#Include<file.au3>
#include <Excel.au3>
#include <Array.au3>
;##################################
; Variables
;##################################


$sFilePath1 = @ScriptDir & "c:\test.xls" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)
_ExcelWriteCell($oExcel, "I Wrote to This Cell", 1, 1) ;Write to the Cell
$sCellValue = _ExcelReadCell($oExcel, 1, 1)

MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)

Share this post


Link to post
Share on other sites
enaiman

$sFilePath1 = @ScriptDir & "c:\test.xls"

What would be the value of this variable ???


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
meatsack

$sFilePath1 "c:\test.xls"

@ScriptDir = Directory containing the running script. (Result does not contain a trailing backslash) I don't know, I will guess that this is where my script or my AutoIt.exe is located. I don't even know if @ScriptDir is a variable.

I am certain $sCellValue is a variable. And this variable should have a value, if not something is wrong such as its not declared, its data needs to be set to zero before using it in the script or sumtin.

Edited by meatsack

Share this post


Link to post
Share on other sites
Beege

@scriptdir is the current directory your script is in. So if the path is wrong your file never gets open and no data gets put into $sCellValue. filepath needs to be:

$sFilePath1 = @ScriptDir & "\test.xls"
Edited by Beege

Share this post


Link to post
Share on other sites
enaiman

You didn't bother to use a message box to see the value for the variable???

I wonder why I'm still helping you ...


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
meatsack

I wonder why I'm still helping you ...

Whoops my bad. Works perfectly now.

@scriptdir is the current directory your script is in. So if the path is wrong your file never gets open and no data gets put into $sCellValue. filepath needs to be:

$sFilePath1 = @ScriptDir & "\test.xls"

Thank you. I should have msgboxed the @ScriptDir variable. I didn't even know it was a variable. I'll try msgbox everything before I use the forum.

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  

×