Jump to content

_ExcelWriteCell() Doesn't Write Text To Cell


Mongoose
 Share

Recommended Posts

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)

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 5 weeks later...

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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.
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...