Migrate Excel 4 macro file to 2010

perp1exed

New Member
Joined
Oct 28, 2011
Messages
20
Hi,

In the process of this I had one problem... the Excel 4 sheet macros have commands that manipulate the menu system. Since 2010 uses ribbon these will obviously no longer work.

So I removed those macro lines that touched the menu system.

There is one macro which calls the File Open dialog box.

The Macro is called OpenFile and its contents are:

=OPEN?()

Now, when I go to macros and manually Run this it works and opens the dialog.

But when I try to assign this macro to the onAction of a custom ribbon button I get an error Sub or Function not defined.

Is there a workaround/fix for this? Why can my ribbons onAction event not fire the macro when I can do it manually?

thanks,

KS
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You probably need something like

Code:
Dim fName As Variant
fName = Application.GetOpenFilename(FileFilter:="Excel Files (*.XLS), *.XLS", Title:="Select File To Be Opened")
If fName = False Then Exit Sub
Workbooks.Open Filename:=fName
 
Upvote 0
@Andrew

Yes thank you, this does work.

Maybe the solution then is to replace parts of the Excel 4 macro sheet functions that no longer work in 2010.

What are your thoughts?

thanks.
 
Upvote 0
If you are using the CustomUI.xml to add the ribbon buttons, then the onAction is actually a callback that requires a particular signature, not a macro. You should however be able to call your macro from the callback.
 
Upvote 0
@rorya,

I am using the following:

Private Sub Opener(ByVal control As IRibbonControl) <------onAction is Opener and here is signature of callback
OpenFile <---- macro which opens dialog
End Sub

This does not work for me.

thanks.
 
Upvote 0
@rorya, @Andrew,

Actually, I think the ribbon button functions do not like calling any of these Excel 4 macros. I get the same error for another macro which is not menu related.

Maybe a rewrite it is ugghhh!
 
Upvote 0
Have you tried:
Code:
Application.run "openfile"
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top