Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bz bz is offline
external usenet poster
 
Posts: 16
Default task bar attached macro name probles

Dave Peterson wrote in
:

Thanks! Lots of stuff to read over. Looks like it will be useful. I knew I
must have missed the solution(s).

Ps. David McRitchie has lots of notes he
http://www.mvps.org/dmcritchie/excel/toolbars.htm
Look for:
Repair Renamed Pathnames on Menus and Toolbar Buttons
and you'll see a link to a newsgroup post by Bernie Deitrick

http://groups.google.com/group/micro...msg/d692c7e54d
fe909b?as_umsgid=eNXt5XX5BHA.1020@tkmsftngp07

Or

http://snipurl.com/121mv

bz wrote:

Google shows me many who have asked this question, but no solutions.
The problem seems to have existed since the early days of VB macros
being incorporated into excel.

The problem: intermittently when an excel document with VB macros
attached to a menu bar and/or a task bar is save-as renamed, the links
to the macros point to the OLD excel file's name[with the full path
being given!]. This makes the wrong macros execute or give an error
message when attempting to execute the macros.

.....


--
bz

please pardon my infinite ignorance, the set-of-things-I-do-not-know is an
infinite set.


  #2   Report Post  
Posted to microsoft.public.excel.programming
bz bz is offline
external usenet poster
 
Posts: 16
Default task bar attached macro name probles

Dave Peterson wrote in
:

Sorry, looked over the links and they seem aimed at fixing links to macros
stored in personal.xls.

My problem is when I rename my workbook via SaveAs, the manually attached
macros (attached to BOTH a menu bar and a toolbar) that are part of the
workbook in question, INTERMITTENTLY get OnAction values that include the
entire path and filename rather than just the macro's name.

If the file is renamed or moved, the macros will then fail to work, or I end
up executing the WRONG macros (those in the old location). This is especially
problematic when I send someone the workbook so that they can run it on their
system.

I want to REMOVE everything except the macro's name so that excel will look
in the CURRENT workbook for the macro.

It appear that I will have to write a macro to do something like the
following:

for i = 1 to CmdBar.Controls.count
If CmdBar.Controls(i).BuiltIn = True and _
CmdBar.Controls(i).Caption = "MY Command Bar" Then
For j = 1 To CmdBar.Controls(i).Controls.Count
If InStr(1, CmdBar.Controls(i).Controls(j).OnAction, ":\") 0 Then
Dim ActionString as String
ActionString = CmdBar.Controls(i).Controls(j).OnAction
CmdBar.Controls(i).Controls(j).OnAction = _
Right(ActionString, Len(ActionString) - InStr(1, ActionString, _
"!")+1)
End if
Next j
End if
Next i

Untested as of yet. I am NOT sure if this will fix both Menu Bars and Tool
Bars. I am not even sure it will work.

Do you see any obvious flaws or improvements that could be made easily?

Thanks.

Ps. David McRitchie has lots of notes he
http://www.mvps.org/dmcritchie/excel/toolbars.htm
Look for:
Repair Renamed Pathnames on Menus and Toolbar Buttons
and you'll see a link to a newsgroup post by Bernie Deitrick

http://groups.google.com/group/micro.../msg/d692c7e54
d fe909b?as_umsgid=eNXt5XX5BHA.1020@tkmsftngp07

Or

http://snipurl.com/121mv

bz wrote:

Google shows me many who have asked this question, but no solutions.
The problem seems to have existed since the early days of VB macros
being incorporated into excel.

The problem: intermittently when an excel document with VB macros
attached to a menu bar and/or a task bar is save-as renamed, the links
to the macros point to the OLD excel file's name[with the full path
being given!]. This makes the wrong macros execute or give an error
message when attempting to execute the macros.

....





--
bz

please pardon my infinite ignorance, the set-of-things-I-do-not-know is an
infinite set.

[remove c h 1 0 0 - 5 to avoid spamtrap]
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default task bar attached macro name probles

Personally, I try not to have to worry about reassigning the buttons to the
macros in the correct workbook. I build the toolbar/menu items when the
workbook opens.

Life got lots easier when I started doing that.

bz wrote:

Dave Peterson wrote in
:

Sorry, looked over the links and they seem aimed at fixing links to macros
stored in personal.xls.

My problem is when I rename my workbook via SaveAs, the manually attached
macros (attached to BOTH a menu bar and a toolbar) that are part of the
workbook in question, INTERMITTENTLY get OnAction values that include the
entire path and filename rather than just the macro's name.

If the file is renamed or moved, the macros will then fail to work, or I end
up executing the WRONG macros (those in the old location). This is especially
problematic when I send someone the workbook so that they can run it on their
system.

I want to REMOVE everything except the macro's name so that excel will look
in the CURRENT workbook for the macro.

It appear that I will have to write a macro to do something like the
following:

for i = 1 to CmdBar.Controls.count
If CmdBar.Controls(i).BuiltIn = True and _
CmdBar.Controls(i).Caption = "MY Command Bar" Then
For j = 1 To CmdBar.Controls(i).Controls.Count
If InStr(1, CmdBar.Controls(i).Controls(j).OnAction, ":\") 0 Then
Dim ActionString as String
ActionString = CmdBar.Controls(i).Controls(j).OnAction
CmdBar.Controls(i).Controls(j).OnAction = _
Right(ActionString, Len(ActionString) - InStr(1, ActionString, _
"!")+1)
End if
Next j
End if
Next i

Untested as of yet. I am NOT sure if this will fix both Menu Bars and Tool
Bars. I am not even sure it will work.

Do you see any obvious flaws or improvements that could be made easily?

Thanks.

Ps. David McRitchie has lots of notes he
http://www.mvps.org/dmcritchie/excel/toolbars.htm
Look for:
Repair Renamed Pathnames on Menus and Toolbar Buttons
and you'll see a link to a newsgroup post by Bernie Deitrick

http://groups.google.com/group/micro.../msg/d692c7e54
d fe909b?as_umsgid=eNXt5XX5BHA.1020@tkmsftngp07

Or

http://snipurl.com/121mv

bz wrote:

Google shows me many who have asked this question, but no solutions.
The problem seems to have existed since the early days of VB macros
being incorporated into excel.

The problem: intermittently when an excel document with VB macros
attached to a menu bar and/or a task bar is save-as renamed, the links
to the macros point to the OLD excel file's name[with the full path
being given!]. This makes the wrong macros execute or give an error
message when attempting to execute the macros.

....



--
bz

please pardon my infinite ignorance, the set-of-things-I-do-not-know is an
infinite set.

[remove c h 1 0 0 - 5 to avoid spamtrap]


--

Dave Peterson
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
formula probles - so lost hsb101 New Users to Excel 5 August 5th 06 12:48 AM
running an XLS Macro from within an XLS attached as Object jaak de vuyst Excel Programming 0 May 7th 06 09:45 AM
I get a macro warning when there are no macros attached JenML5 Excel Programming 2 April 21st 05 10:18 PM
macro attached to workbook: to be sent to other users John F[_2_] Excel Programming 1 December 13th 04 09:33 PM
Macro attached to button runs twice Jozef[_2_] Excel Programming 0 November 4th 04 01:36 PM


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