Jump to content
Sign in to follow this  
alfa

Excel Macros wont show

Recommended Posts

alfa

Hello,

I have a problem with seeing the excel macros that i have in my personal.xlsb file when i open it with this line. I am using office 2010.

_ExcelBookOpen ("c:\Documents and Settings\aozben\Desktop\Cap Rep\TK_LO_Cap_Rep.xls")

Is there a work around for this ?

Share this post


Link to post
Share on other sites
sleepydvdr

Not knowing much about your problem, one thing stands out. You say you have a problem with opening "personal.xlsb" but your script shows you trying to open "TK_LO_Cap_Rep.xls".

I tested to see if the UDF opens an xlsb extension and it does. My only conclusion is that you are not giving the script the correct path to your file. Check it again. And make sure you are getting the extension right.


#include <ByteMe.au3>

Share this post


Link to post
Share on other sites
alfa

personal.xlsb is the file that is in XLstart directory where you store the macros. That file autoloads normally. But not when i run excel with _ExcelBookOpen command.

Share this post


Link to post
Share on other sites
Juvigy

Please show your code. Is your Excel security and Macrio settings low ?

Share this post


Link to post
Share on other sites
alfa

The code doesnt matter, even if you make a one line code like the one in the first post , it doesnt show the macros. I will checkt the excel security settings.

Share this post


Link to post
Share on other sites
Juvigy

I have excel 2007 and it works for me. I can show you how you can insert and execute a macro from a file.

Share this post


Link to post
Share on other sites
alfa

Yes i would love to get some help. I am using 2010.

Share this post


Link to post
Share on other sites
Juvigy

$oExcel = ObjCreate("Excel.Application")
    $oExcel.Visible = 1
    $oExcel.WorkBooks.Open("C:\2010.xls")
    $oModules = $oExcel.ActiveWorkbook.VBProject.VBComponents
    For $oModule in $oModules
        ConsoleWrite($oModule.Name&@CRLF)
    Next
     $oModules.Import("C:\Module1.bas")
     $oExcel.Run("Macro1",$date2,$FileName3) ;my macro accepts parameters
     $oExcel.ActiveWorkbook.Save
     $oExcel.ActiveWorkbook.Close

This is how i import and run a macro.

Share this post


Link to post
Share on other sites
alfa

Hmm, what i was referring is , you know you get a list of the macros you have in your xlsb file under XL start when ypu press alt+f8. So some how it is not starting the file under xlstart. when i use the _ExcelBookopen.

Share this post


Link to post
Share on other sites
Juvigy

Yea , i get it , but it starts on my Excel 2007 so it should be an Excel configuration or something similar.

Maybe the security and trust center settings needs to be lowered. As a workaround you may use the exmaple for inserting macros.

Share this post


Link to post
Share on other sites
footswitch

Hey guys.

This got me very close to what I'm trying to do here.

I want to hide the Ribbon (Office 2007), kind of full screen mode, so all I'd have would be the Excel cell grid.

I suppose this would allow me to integrate an Excel grid in an AutoIt GUI.

This is what I use:

Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"

However, passing this action to the Excel object produces no changes.

Importing and then running the Macro (as shown in the post above) returns an error.

After the error, when I choose to debug, if I stop and rerun that macro, the Ribbon becomes hidden successfully.

Any thoughts?

Thanks in advance for your time,

footswitch


Share this post


Link to post
Share on other sites
JoHanatCent

Hey guys.

This got me very close to what I'm trying to do here.

I want to hide the Ribbon (Office 2007), kind of full screen mode, so all I'd have would be the Excel cell grid.

I suppose this would allow me to integrate an Excel grid in an AutoIt GUI.

This is what I use:

Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"

However, passing this action to the Excel object produces no changes.

Importing and then running the Macro (as shown in the post above) returns an error.

After the error, when I choose to debug, if I stop and rerun that macro, the Ribbon becomes hidden successfully.

Any thoughts?

Thanks in advance for your time,

footswitch

This is not exactly what the OP's problem was however try:

#include <Excel.au3>
$oExcel = _ExcelBookOpen(@DesktopDir & "\test.xls", 1)
$oExcel.ExecuteExcel4Macro ("SHOW.TOOLBAR(""Ribbon"",False)")

Share this post


Link to post
Share on other sites
footswitch

@JoHanatCent

Thanks for your reply. Yes, it's almost off-topic. Sorry about that.

Please tell me, did you try this code yourself?

With it, Excel 2007 returns this error (translated from Portuguese): "there's an error with your formula (...)".

In fact, before messing around with Macro files, I've tried several variations of that command, all to no avail.

The Macro Import method really seems to be the closest to success - in such a way that it works fine when called from Excel itself, but doesn't when called via COM.

footswitch


Share this post


Link to post
Share on other sites
JoHanatCent

@JoHanatCent

Thanks for your reply. Yes, it's almost off-topic. Sorry about that.

Please tell me, did you try this code yourself?

With it, Excel 2007 returns this error (translated from Portuguese): "there's an error with your formula (...)".

In fact, before messing around with Macro files, I've tried several variations of that command, all to no avail.

The Macro Import method really seems to be the closest to success - in such a way that it works fine when called from Excel itself, but doesn't when called via COM.

footswitch

Yes I did.

Maybe there is a Portuguese word for "Ribbon" Used?


Share this post


Link to post
Share on other sites
footswitch

Well I've tried "Friso" as well, but doesn't work either.

If it works for you and not for me I have to accept that this method wouldn't be reliable anyway.

Nevertheless, thanks again for your help.

Regards,

footswitch


Share this post


Link to post
Share on other sites
DutchCoder

Try this:

$oExcel.Application.ExecuteExcel4Macro('SHOW.TOOLBAR("Ribbon",False)')

Share this post


Link to post
Share on other sites
JLogan3o13

@DutchCoder did you happen to notice this thread is 7 years old?! Please don't resurrect old threads.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
DutchCoder

I needed it myself and found out it was never soveld on the forums...

See my rebuilt notepad replacement into Excel replacement by rewriting three lines of code.

(Ribbon code in plain GDI is not available. sorry)

Excel.jpg

Share this post


Link to post
Share on other sites
JLogan3o13

That doesn't change that you should have created a new topic.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×