LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default ONACTION macro tries to open another workbook

I have a userform in a book where you check a box called
Fillcolour(one of many checkboxes on the UserForm).
Then you press OK - this triggers the following macro:

Private Sub CmdOK_Click()

Me.Hide
Application.ScreenUpdating = False
Call AddMenuModifications
Unload Me
Application.ScreenUpdating = True

End Sub

Then in a normal module:

Sub AddMenuModifications()

On Error Resume Next
With CommandBars("Cell")
If UsrMenuBars.ChkFillColour Then
With .Controls.Add(msoControlButton)
.Caption = "Fill Colour"
.FaceId = 417
.OnAction = "ShowColorPallet"
End With
End If

End Sub

and in the same module:

Sub ShowColorPallet()
With Application.CommandBars("Fill Color")
.Top = 350
.Left = 500
.Visible = True
End With
End Sub

If I put just this code in a workbook on its own then it works fine -
but in the book I want it in, there are lots of bits of code like the
above which modify excel commandbars.
Anyhow when I press the new modifications excel opens another copy of
the workbook with the onaction code in it (or tries to - it tells me
I'm already in it, which I am!) - it then comes up with an error
message that just says "400"

Anyone ever seen this before??

Help greatly appreciated (I can forward the whole workbook if thats
any help)

Jason.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro - onAction arguments version83 Excel Worksheet Functions 2 April 10th 10 09:59 PM
Open Workbook Macro??? Supe Excel Discussion (Misc queries) 2 December 19th 07 08:37 PM
How to Run Macro in open workbook/s hni Excel Discussion (Misc queries) 1 October 31st 05 10:14 AM
how can I run a macro when I open a workbook? filo666 Excel Discussion (Misc queries) 2 March 2nd 05 07:56 PM
.ONACTION macro call fails Wayne Excel Discussion (Misc queries) 2 March 2nd 05 05:10 PM


All times are GMT +1. The time now is 10:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"