nicky40 Posted April 28, 2009 Posted April 28, 2009 Hey guys, I'm trying to make a really simple script utilizing the Excel.AU3 documentation. CODE#include <Excel.au3> Global $sXLS = "C:\StartingPoint1.xls" Global $oExcel = _ExcelBookOpen($sXLS) _ExcelSheetActivate($oExcel, "sheet1") _ExcelWriteCell($oExcel, "File Name", "A5") _ExcelBookClose($oExcel, 1, 0) The script completes w/out crashing, but there is no file alterations. I've also tried the: CODE_ExcelBookSaveAs($oExcel, @ScriptDir & "\SaveAsExample", "xls") Still no luck. Thanks, Nicholas
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 And like my previous posts, I'm willing to paypal donate to whoever helps!
theAutoitSpammer Posted April 28, 2009 Posted April 28, 2009 (edited) Your script works for me I had a similar problem with an excel function, the solution was 'registry cleaning' I don't think offering money is a good idea, we all do it for fun, if we can help we will. Al And like my previous posts, I'm willing to paypal donate to whoever helps! Edited April 28, 2009 by alram
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 Your script works for me I had a similar problem with an excel function, the solution was 'registry cleaning' I don't think offering money is a good idea, we all do it for fun, if we can help we will. AlIt edits the excel file and saves it?! I don't understand why it won't work on my system. grr :?
theAutoitSpammer Posted April 28, 2009 Posted April 28, 2009 (edited) I insert a 1 sec sleep before close and worked, then I delete the sleep and still worked. Like I said a registry cleaning worked for me. Is the "C:\StartingPoint1.xls" file exists?? if this solution works, please mark your original post as [sOLVED] It edits the excel file and saves it?! I don't understand why it won't work on my system. grr :? Edited April 28, 2009 by alram
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 I insert a 1 sec sleep before close and worked, then I delete the sleep and still worked. Like I said a registry cleaning worked for me if this solution works, please mark your original post as [sOLVED] What cleaner did you use? I'd be much appreciative if you could share the name!
theAutoitSpammer Posted April 28, 2009 Posted April 28, 2009 I use Registry Mechanic but there are many more for freeCaution---please understand that messing with the registry could be dangerous I would learn as much as possible before doing it.What cleaner did you use? I'd be much appreciative if you could share the name!
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 I use Registry Mechanic but there are many more for freeCaution---please understand that messing with the registry could be dangerous I would learn as much as possible before doing it.Didn't work, I'm not sure this would have fixed the issue. You can confirm this works on your system?Anybody else out there able to test something like this?
Juvigy Posted April 28, 2009 Posted April 28, 2009 Which version of excel do you have ? You need to enable some settings : Try this one : RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security", "ExtensionHardening", "REG_DWORD", 0) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "ExtensionHardening", "REG_DWORD", 0) They are for 2007 and 2003 versions
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 Which version of excel do you have ? You need to enable some settings :Try this one :RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1)RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1)RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security", "ExtensionHardening", "REG_DWORD", 0)RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "ExtensionHardening", "REG_DWORD", 0)They are for 2007 and 2003 versionsI'm on 2007, I'm not really familar with RegWrite, would you mind giving a short explanation?Thanks,Nicholas
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 Which version of excel do you have ? You need to enable some settings :Try this one :RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1)RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1)RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Excel\Security", "ExtensionHardening", "REG_DWORD", 0)RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "ExtensionHardening", "REG_DWORD", 0)They are for 2007 and 2003 versionsDropped them into my script, and still no dice, I have to be doing something fundamentally wrong.
Juvigy Posted April 28, 2009 Posted April 28, 2009 This lines writes to the registry. This enables the Excel to trust access to Visual Basic. As i think about it now it is more related to VB scripts but i am not sure if it has impact on the Excel object model. Please try it and see if it works.You can skip the : RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1) It is for 2003.
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 This lines writes to the registry. This enables the Excel to trust access to Visual Basic. As i think about it now it is more related to VB scripts but i am not sure if it has impact on the Excel object model. Please try it and see if it works.You can skip the :RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security", "AccessVBOM", "REG_DWORD", 1)It is for 2003.I must have posted right before you, but I tried and still nothing, I'm thinking for something is wrong funamentally in my script.
Juvigy Posted April 28, 2009 Posted April 28, 2009 (edited) it forks for me too. Global $sXLS = "C:\StartingPoint1.xls" Global $oExcel = _ExcelBookOpen($sXLS Does StartingPoint1.xls exist in c:\ ? #include <Excel.au3> Global $sXLS = "C:\123.xls" Global $oExcel = _ExcelBookOpen($sXLS) _ExcelSheetActivate($oExcel, "sheet1") _ExcelWriteCell($oExcel, "File Name", "A5") _ExcelBookClose($oExcel, 1, 0) Try this one. But fist create a new Excel file called 123.xls in C drive Edited April 28, 2009 by Juvigy
nicky40 Posted April 28, 2009 Author Posted April 28, 2009 Yeah tried that version, and still no result. I guess it's my local computer?it forks for me too.Global $sXLS = "C:\StartingPoint1.xls"Global $oExcel = _ExcelBookOpen($sXLSDoes StartingPoint1.xls exist in c:\ ?#include <Excel.au3>Global $sXLS = "C:\123.xls"Global $oExcel = _ExcelBookOpen($sXLS)_ExcelSheetActivate($oExcel, "sheet1")_ExcelWriteCell($oExcel, "File Name", "A5")_ExcelBookClose($oExcel, 1, 0)Try this one. But fist create a new Excel file called 123.xls in C drive
theAutoitSpammer Posted April 28, 2009 Posted April 28, 2009 EXCEL 2007 SAVES FILES AS 123.XLSX WHEN NOT IN COMPATIBILITY MODE AND YOUR SCRIPT IS TRYING TO LOAD A 123.XLS COULD THAT BE YOUR PROBLEM?
nicky40 Posted May 4, 2009 Author Posted May 4, 2009 EXCEL 2007 SAVES FILES AS 123.XLSX WHEN NOT IN COMPATIBILITY MODEAND YOUR SCRIPT IS TRYING TO LOAD A 123.XLSCOULD THAT BE YOUR PROBLEM? <3 Thank you sir/maime. This solved my problem, thank you so much.
theAutoitSpammer Posted May 4, 2009 Posted May 4, 2009 <3 Thank you sir/maime. This solved my problem, thank you so much. Happy to hear it. Please mark your original post with [sOLVED] or [RESOLVED] Al
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now