hulashakes
New Member
- Joined
- Feb 19, 2010
- Messages
- 7
My 'Update_Button' macro is supposed to do this -
1 - Open a file (Sample.xls)
2 - Update a button (Button 1) to point to a different macro
3 - Save the file
4 - Close the file
More information -
This macro is set to run on a directory and open each file and update each file. This macro is saved in a file called "Macro_Excel.xls" The macro runs fine, but it creates a reference back to Sheet 1 in the Macro_Excel.xls file. I want it to reference to Sheet1 in the file that it is in (Sample.xls), not back to Macro_Excel.xls
The code is this:
So, from the code, I expect it to update the button with "Sheet1.ProjectUpdate_Entry".
However, it updates it with "Macro_Excel.xls!Sheet1.ProjectUpdate_Entry" because I am running the macro from Macro_Excel.xls
I have searched MrExcel and google and I can't find anything that helps. I am frustrated. If anyone can help, it would be greatly appreciated.
1 - Open a file (Sample.xls)
2 - Update a button (Button 1) to point to a different macro
3 - Save the file
4 - Close the file
More information -
This macro is set to run on a directory and open each file and update each file. This macro is saved in a file called "Macro_Excel.xls" The macro runs fine, but it creates a reference back to Sheet 1 in the Macro_Excel.xls file. I want it to reference to Sheet1 in the file that it is in (Sample.xls), not back to Macro_Excel.xls
The code is this:
Code:
Sub Update_Button_To_Absolute()
' This portion generates the list of files in the directory[INDENT]Dim F As String
Dim roww As Long
roww = 0
Dim FileLocSpec As String
FileLocSpec = "D:\DirectoryOfFiles\*.xls"
F = Dir(FileLocSpec)
Do Until F = ""
roww = roww + 1
Cells(roww, 1).Value = F
F = Dir
Loop
[/INDENT]Set r = Range("A1")
While r.Value <> ""
Workbooks.Open Filename:="D:\DirectoryOfFiles\" & r.Value
[INDENT]' This is the actual copy once the file is open
Windows(r.Value).Activate
Worksheets("Entry").Shapes("Button 1").OnAction = "Sheet1.ProjectUpdate_Entry"
' End of the update button Macro portion
[/INDENT]ActiveWorkbook.Save
ActiveWorkbook.Close
Set r = r.Offset(1, 0)
Wend
End Sub
However, it updates it with "Macro_Excel.xls!Sheet1.ProjectUpdate_Entry" because I am running the macro from Macro_Excel.xls
I have searched MrExcel and google and I can't find anything that helps. I am frustrated. If anyone can help, it would be greatly appreciated.