Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default assigned macro taking the name of file creating it. Please help.

Without setting up the workbooks to copy the macro for car_allowance into each
project (I just copies manually), this change seemed to get the right workbook.

Selection.OnAction = ActiveSheet.Parent.Name & "!Car_Allowance"



a wrote:

Hi,

I'm trying to add some buttons and a module to a group of files. This
is the code I use to add the button and assign the macro and add the module.

This all works (these are just fragments of the code) but the macro that
is assigned is preceded by the file name of the file that I am using to
insert the module and add the button.

Is there any way around this?

As always, any help would be much appreciated.

Anita

Set SourceModule = _
Workbooks("AddingModule.xls").VBProject.VBComponen ts("Module3").CodeModule

Set DestModule = _
Workbooks(fileWextention).VBProject.VBComponents(" CarAllowance").CodeModule
With SourceModule
DestModule.AddFromString ( _
.Lines(.ProcStartLine("Home_Car_Allowance", vbext_pk_Proc), _
.ProcCountLines("Home_Car_Allowance", vbext_pk_Proc)))

End With
ActiveSheet.Unprotect ("nope")
ActiveSheet.Buttons.Add(1125.75, 179.25, 129.75, 14.25).Select

Selection.Characters.Text = "Car Allowance"
With Selection.Characters(Start:=1, Length:=13).Font
.Name = "MS Sans Serif"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.OnAction = "Car_Allowance"


--

Dave Peterson

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default assigned macro taking the name of file creating it. Please help.



A

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply
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
Use Macro To Change Which Macro Assigned To Command Button CVinje Excel Discussion (Misc queries) 0 May 25th 10 09:55 PM
Macro assigned to a button Sadcrab Excel Discussion (Misc queries) 12 December 8th 06 11:16 PM
Macro Assigned to a Button zephyr Excel Discussion (Misc queries) 1 October 25th 06 03:33 PM
How to save file in a macro taking new name from cell contents? LowIQ Excel Discussion (Misc queries) 3 May 31st 06 10:52 PM
How do I know what macro is assigned to a button? Denise in NC Excel Discussion (Misc queries) 3 April 3rd 06 02:31 PM


All times are GMT +1. The time now is 06:32 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"