Jump to content

Any help for the n00bs?


Recommended Posts

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

Link to comment
Share on other sites

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 by alram
Link to comment
Share on other sites

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

It edits the excel file and saves it?! I don't understand why it won't work on my system. grr :?

Link to comment
Share on other sites

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 by alram
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

I use Registry Mechanic but there are many more for free

Caution---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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

I'm on 2007, I'm not really familar with RegWrite, would you mind giving a short explanation?

Thanks,

Nicholas

Link to comment
Share on other sites

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

Dropped them into my script, and still no dice, I have to be doing something fundamentally wrong.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by Juvigy
Link to comment
Share on other sites

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($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

Link to comment
Share on other sites

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? ^_^

<3 Thank you sir/maime. This solved my problem, thank you so much.

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...