Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default code to update a macro



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 Befo=Workbooks(mylinkname
& ".xls").Sheets(2)
ActiveWorkbook.ChangeLink Name:="jul021",
NewName:=mylinkname & ".xls", Type:= _
xlExcelLinks
Windows("jul021").Visible = False
Application.DisplayAlerts = True

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default code to update a macro

Chip Pearson's page on programming in the VBE:
http://www.cpearson.com/excel/vbe.htm

should get you started.

--
regards,
Tom Ogilvy

"Paul" wrote in message
...


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 Befo=Workbooks(mylinkname
& ".xls").Sheets(2)
ActiveWorkbook.ChangeLink Name:="jul021",
NewName:=mylinkname & ".xls", Type:= _
xlExcelLinks
Windows("jul021").Visible = False
Application.DisplayAlerts = True

End Sub



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
update code Lost Excel Discussion (Misc queries) 0 January 16th 09 04:53 AM
Any way to update links tru VBA code? nrage21[_47_] Excel Programming 1 March 5th 04 05:32 PM
Automatic update of code in other workbook Tony C[_2_] Excel Programming 2 February 17th 04 12:34 PM
Code to Update a Record No Name Excel Programming 1 January 29th 04 10:02 PM
Update VBA Module Code Todd Huttenstine[_2_] Excel Programming 1 December 27th 03 10:15 AM


All times are GMT +1. The time now is 05:36 PM.

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"