Excel Macro binding

F

Franck

Ok here it's not a question about making a macro it's about binding it
on the toolbar or custom toolbar to prevent the bug i'm having.

Here's the problem :
I made a vba code in a module that take the selected image and give it
a left/top/width position and add border to it, i work pretty well. The
problem is when i add it to the toolbar
here are my steps, Click on the kind of arrow and select add/remove
button i select in the second tab macro, after i right click on the
brand new macro icon and i go on affect new macro(i guess it's that in
english my excel is in french well it's the bottom one) and after in
the bottom in macro in : i select current document and i see my macro,
i select it and click ok everywhere and bang it's there, i save it
close reopen, and it work. now the problem appear when i make a copy of
this file, the macro like i add it still pointing to the original if i
delete the original file it say something like excelfile1.xls!mymacro
cannot be found bla bla bla. Is there a way to keep the button binded
to the current project macro. is there any vba function to rebind it
eachtime, go for solution im a vb developper i can understand anything.
 
G

Guest

There must be a reference in your macro to the original file name. If so,
change it so that if references the filename in which it resides and it
should run OK. Otherwise, I don't Know what could be the problem.
 
F

Franck

the macro :

Public Sub Formatimage()
=========================================
Selection.ShapeRange.Fill.Visible = msoFalse
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 4.5
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.Style = msoLineThinThick
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.SchemeColor = 32
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)

Dim mypic As Shape
For Each mypic In ActiveSheet.Shapes
mypic.Left = 70
mypic.Top = 332
mypic.Width = 320
Next

End Sub
==================================================

JLGWhiz a écrit :
 
F

Franck

I did this following thing that the MVP said :

http://groups.google.ca/group/micro...nts+to+old+file&rnum=6&hl=en#9b74fb08d5f5a55e

the problem is nearly the same except it's happening when im copying
the file localy or remotely

Myfile.xls
- macro use the macro in Myfile.xls

Copy of Myfile.xls
- macro use the macro of Myfile.xls

i have tried to remove the toolbar at exit and recreate it at startup
but the button appear and when i click it ask to wich macro i want it
to run, i can't let it like that the user must not have this popup.
 
F

Franck

anyone got a hint please still havent found
I did this following thing that the MVP said :

http://groups.google.ca/group/micro...nts+to+old+file&rnum=6&hl=en#9b74fb08d5f5a55e

the problem is nearly the same except it's happening when im copying
the file localy or remotely

Myfile.xls
- macro use the macro in Myfile.xls

Copy of Myfile.xls
- macro use the macro of Myfile.xls

i have tried to remove the toolbar at exit and recreate it at startup
but the button appear and when i click it ask to wich macro i want it
to run, i can't let it like that the user must not have this popup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top