Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Restricting VBA macros

How can I force a workbook to always use the macros stored in tha
workbook even if I do a file save as? The macros in the original file
after I do a save as, point to the newly saved as file, so when I ope
the original one, all the macros faile 'cause they are pointing to th
saved as file.

HELP!!!!! thanks:( :confused

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Restricting VBA macros

Write code to go through and change them back. (I assume you are talking
about toolbar onaction macros).

Here is some code posted recently by Bernie Deitrick:

Sub RepairUserDefinedButtons3()
Dim CmdBar As CommandBar
Dim i As Integer
On Error GoTo ErrorReading:

For Each CmdBar In CommandBars
For i = 1 To CmdBar.Controls.Count
If CmdBar.Controls(i).BuiltIn = False Then
If InStr(1, CmdBar.Controls(i).OnAction, _
"my-macros.xls") Then
CmdBar.Controls(i).OnAction = _
Replace(CmdBar.Controls(i).OnAction, _
"my-macros.xls", "my-macros.xla")
End If
End If
ErrorReading:
Next i
Next CmdBar
End Sub


Change my-macros.xls to the saved as workbook name and my-macros.xls to the
original workbook name.

--
Regards,
Tom Ogilvy

"halem2 " wrote in message
...
How can I force a workbook to always use the macros stored in that
workbook even if I do a file save as? The macros in the original file,
after I do a save as, point to the newly saved as file, so when I open
the original one, all the macros faile 'cause they are pointing to the
saved as file.

HELP!!!!! thanks:(


---
Message posted from http://www.ExcelForum.com/



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
Restricting entry scubas Excel Worksheet Functions 1 January 11th 10 02:34 PM
restricting use of certain characters Rob Excel Discussion (Misc queries) 4 June 8th 06 01:07 AM
Restricting Rows Old Music Lover Excel Discussion (Misc queries) 1 July 23rd 05 02:27 AM
restricting fonts Ernesto Herrera Jr. Excel Programming 1 February 24th 04 07:05 AM
Restricting cells Noctos[_13_] Excel Programming 5 January 3rd 04 05:09 PM


All times are GMT +1. The time now is 04:53 AM.

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"