gagangoomer Posted October 10, 2013 Report Share Posted October 10, 2013 Is there any command to check the current version of the software. I'm using shortcut keys in a macro to add some text in the header and footer part of MS Word. The shortcut keys differ in MS word 2003 version and MS word 2007+ version. I tried using the Get File Version command and specified the path of the Word Document but it returns 0:0:0:0. Not sure why it is not returing MS word 2003 or 2007 instead. Secondly is there any command to check the version fo the file through its title. Thanks for replying ! Gagan Quote Link to comment Share on other sites More sharing options...
Cory Posted October 10, 2013 Report Share Posted October 10, 2013 Version for files is completely different than version of the application. For instance you can edit old Word .DOC files with the new Word 2007+ .DOCX files. And there really isn't a version in the way your thinking for documents themselves. You need to get the version of Word.exe itself. I had this same problem with Outlook. I first wrote a macro to get the version of Word but depending on the system it could be in one of several places and it had to hunt for them. It was really sloppy and there were holes in this logic so it wasn't a proper solution. EG what if the user installed their programs on a drive named "F". Set objWord = CreateObject("Word.Application") Wscript.Echo objWord.Version objWord.Quit My solution, again, was to turn to the External Script command. Attached is a functioning demo macro but it's so simple as you can see above it's probably not necessary. When you create a Word object one of the properties is the version. So I simply create one and snatch it from there. The one suggestion I have is you might want to add a "Try Catch" for error handling in case it's run on a machine without Word installed.Word Version.mex Quote Link to comment Share on other sites More sharing options...
gagangoomer Posted October 31, 2013 Author Report Share Posted October 31, 2013 Cory, I tested the above macro. When i run the macro it doesn't do anything but it seems like the macro is still running. As i noticed the moving man icon in the taskbar exits but i'm still getting option in ME to stop the macro(even after the macro is finished). I only get an option to pause the macro even stop button is not working. Not sure why it is acting so wierd. Ultimatelly i'd to shutdown ME to get rid of this issue. any thoughts ? Quote Link to comment Share on other sites More sharing options...
Cory Posted October 31, 2013 Report Share Posted October 31, 2013 As I said, do you have Word installed? Did you add error handling? I mentioned Try Catch assuming it was also available in VBScript but I was wrong. So I created the attached version with error handling. But I don't have time to fire up my VM that doesn't have Word to test it on. Also try saving the script to a VBS file and executing it by itself and see how it works. If the attached macro works and the other doesn't I think we should submit it to ISS as a bug. If there's an error in a script MEP should be able to handle it. Word Version with error handling.mex Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.