code to update a macro

P

Paul

I have written/recorded a little macro that removes an old
version of a worksheet and replaces it with the latest
version.I now wish to replace a old macro with a newer
version too.Can you give me the code that would transfer a
module from a new workbook(jul021) to the "old"
workbook,which happens to be called "mylinkname"
Sub update()
Application.DisplayAlerts = False
'Workbooks.Add Template:="\\w2k107132\Brendons
Docs\Templates\jul02.xlt"
Windows("jul021").Visible = False
Sheets("Cover").Select
mylinkname = Range("B6")
Sheets("Program").Select
Sheets("Program").Delete
Windows("jul021").Visible = True
Sheets("Program").Select
Sheets("Program").Copy Before:=Workbooks(mylinkname
& ".xls").Sheets(2)
ActiveWorkbook.ChangeLink Name:="jul021",
NewName:=mylinkname & ".xls", Type:= _
xlExcelLinks
Windows("jul021").Visible = False
Application.DisplayAlerts = True

End Sub
 

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