Jump to content

Cannot save word document - Strange/Unknown error


Recommended Posts

5 minutes ago, water said:

Can you please test for older/newer versions of MS Word (Word 2003 or Word 2007)?

Is it okay if I test it using the 2019 version? That is the only version I have installed at the moment. I will be able to test this later tonight :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

2019 is fine as well.
2003 would tell us if it works with the old .doc format as well ;)

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

Never tried, but I think you could manually start up Word 2003 and then run the script. _Word_Create connects to an already running Word instance.
But you should check the task manager to make sure there is only a single instance before and after _Word_Create :)

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

Tested it on 2003, not working...

Test Word.au3 (25) : ==> COM Error intercepted !
    err.number is:      0x80020006
    err.windescription: Nom inconnu.

    err.description is:     
    err.source is:      
    err.helpfile is:    
    err.helpcontext is:     
    err.lastdllerror is:    0
    err.scriptline is:  25
    err.retcode is:     0x00000000

@error = 0x00000000, @extended = 0x00000000

Save is made in document folder not in script folder.  GJ Water...

Edited by Nine
Link to comment
Share on other sites

The error you get is expected. Word 2003  uses method DocSaveAs whereas Word > 2007 uses method DocSaveAs2.
The following lines first try to save for Word > 2007 and if an error occurs then it uses method DocSaveAs for Word <= 2007. That's why you see error "Nom inconnu" (Unknown name) for Word <= 2007.

$oDoc.SaveAs2($sFileName, $iFileFormat, ...) ; Try to save for >= Word 2010
    If @error = 0x80020006 Then $oDoc.SaveAs($sFileName, $iFileFormat, ...) ; COM error "Unknown Name" hence save for <= Word 2007

So it seems to work fine for older and newer version of MS Word :)
The default folder is not what you and I expected (document folder instead of script folder). Seems the functions docu needs to be updated as well ;)

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

@water Just tested with Microsoft Word 2016 (not 2019, oops :>) and it works:

@error = 0x00000000, @extended = 0x00000000

I can also find the Doc1.docx file under "My Documents" as mentioned by @Nine

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

50 minutes ago, Bert said:

I have an old copy of word 2003 kicking around but here is a different question - seeing how that is 16 year old software and isn't even supported by MS, should we even be worried about dealing with an error like that? Thoughts?

 

When it takes only one line of code to solve a problem (even on obsolete soft), I'd say "Why not"

Link to comment
Share on other sites

well, you can be sure ms isn't going to be testing old retired software. count me in the why bother group. heck, most people in school only ever use google docs for everything. major universities, everything. nobody requires MS docs anymore. Not to say I don't love Office, I buy a family license for 365. I don't think I can ever give up office as we use it at work too.

anyway, for all our products, we only test on the supported OSs. If customers must have old crap, they can pay us for support.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Schools/Colleges aren't the real world, as I'm sure you know. If the students aren't learning on Office products, they'll never make it in the job market. ;)

Any school that still uses Office pre Office 2010, you should send your kids elsewhere.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

3 hours ago, Bert said:

I have an old copy of word 2003 kicking around ...

Thanks for your offer!
@Nine has already tested with Excel 2003 and the solution that works for Excel > 2007 works for Excel <= 2007 as well. So there is no additional code for older versions to fix the problem reported by TheDcoder.
Thanks to everyone for testing!
I think I will fix code and docu in the near future :)

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

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

×
×
  • Create New...