palbiro
06-20-2012, 04:21 AM
I have 2 files in a network drive (Y)
1.) I assign (in Macros.xlsm) a macro to a button in the other file (button.xlsm)
2.) I make a hyperlink to the button.xlsm
The Code in Macros.xlsm
Sub Test()
ChDrive "Y" 'My network drive
ChDir "Y:\temp"
Workbooks.Open Filename:="Button.xlsm", UpdateLinks:=0
Sheets("F").Shapes("M").OnAction = "Macros.xlsm!Copy"
ActiveWorkbook.Close SaveChanges:=True
Cells(1, 1).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:=CurDir + "\Button.xlsm", _
TextToDisplay:=CurDir
End Sub
Sub Copy()
Cells(1, 1) = "Success"
End Sub
If I open the button.xlsm
1.) from Explorer, everythings works perfect, the macroassignment is:
Macros.xlsm!Copy
2.) trough the hyperlink, the macroassigment is:
\\ganymede\infor\Temp\Macros.xlsm!Copy
in the second case pushing the button, I get an error message: the macro in the file inaccessible or the macros are banned.
I have to open my files trough hyperlink, what do I have to do.
I am working with MS Server 2003, SP2. Excel 2010.
I attached the files, if you want to test it, you have to open Macros.xlsm, and run Test.
Thank you very much for your time and help!
1.) I assign (in Macros.xlsm) a macro to a button in the other file (button.xlsm)
2.) I make a hyperlink to the button.xlsm
The Code in Macros.xlsm
Sub Test()
ChDrive "Y" 'My network drive
ChDir "Y:\temp"
Workbooks.Open Filename:="Button.xlsm", UpdateLinks:=0
Sheets("F").Shapes("M").OnAction = "Macros.xlsm!Copy"
ActiveWorkbook.Close SaveChanges:=True
Cells(1, 1).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, _
Address:=CurDir + "\Button.xlsm", _
TextToDisplay:=CurDir
End Sub
Sub Copy()
Cells(1, 1) = "Success"
End Sub
If I open the button.xlsm
1.) from Explorer, everythings works perfect, the macroassignment is:
Macros.xlsm!Copy
2.) trough the hyperlink, the macroassigment is:
\\ganymede\infor\Temp\Macros.xlsm!Copy
in the second case pushing the button, I get an error message: the macro in the file inaccessible or the macros are banned.
I have to open my files trough hyperlink, what do I have to do.
I am working with MS Server 2003, SP2. Excel 2010.
I attached the files, if you want to test it, you have to open Macros.xlsm, and run Test.
Thank you very much for your time and help!