Sign in to follow this  
Followers 0
Mongoose

_ExcelWriteCell() Doesn't Write Text To Cell

5 posts in this topic

I have a script that opens an Excel file that is stored on a network drive and updates some of the cells using _ExcelWriteCell.

Occasionally, the Excel file will open just fine but the target cells don't get updated.

What could be causing this behaviour?

The relevant lines of code are as follows:

$oExcel = _ExcelBookOpen($FileName)

_ExcelWriteCell($oExcel,$FileNumber,"E" & $k)

Share this post


Link to post
Share on other sites



You need to add some error checking to your script!

What is the value of $FileNumber, what is the value of $k, what is the return value of _ExcelWriteCell, what is the value of @error and @extended after calling _ExcelWriteCell?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I can do the error checking.

My real question is whether anyone else had experienced anything similar and what could have caused this anamolous behaviour.

Share this post


Link to post
Share on other sites

We need the information I asked for in my above post to really help you.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I can do the error checking.

My real question is whether anyone else had experienced anything similar and what could have caused this anamolous behaviour.

Although I am not a very advanced user, I do use the Excel functions quite a bit, and Yes, I have experienced this behavior before. Usually, it is because there was a problem with the _ExcelBookOpen command syntax or that of the _ExcelWriteCell. The Error checking suggestions will probably lead you to the solution. If not, posting the results here will. In my experience, it is usually badly hacked code that isn't doing what I expect it to be doing; sometimes, despite my errors, it works out and writes to the intended cell despite my mistakes, othertimes it doesn't.

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  
Followers 0