#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default ChangeLink

Hello,

I am using the following code:


secondFilename = "C:\"
secondFilename = secondFilename & CStr(Range("D2").Value)
secondFilename = secondFilename & "_04_siteadutysheet.xls"

thirdFilename = "C:\"
thirdFilename = thirdFilename & CStr(Range("D2").Value)
thirdFilename = thirdFilename & "_04_siteatills.xls"

Range("U1").Select
Selection.Copy
Range("D2").Select
Selection.pastespecial Paste:=xlPasteValues,
Operation:=xlAdd, SkipBlanks:=False, Transpose:=False
Range("V1").Select
Selection.Copy
Range("R2").Select
Selection.pastespecial Paste:=xlPasteValues,
Operation:=xlAdd, SkipBlanks:=False, Transpose:=False

fourthFilename = "C:\"
fourthFilename = fourthFilename & CStr(Range("D2").Value)
fourthFilename = fourthFilename & "_04_siteadutysheet.xls"

ActiveWorkbook.ChangeLink secondFilename, fourthFilename,
xlExcelLinks

fifthFilename = "C:\"
fifthFilename = fifthFilename & CStr(Range("D2").Value)
fifthFilename = fifthFilename & "_04_siteatills.xls"

ActiveWorkbook.ChangeLink thirdFilename, fifthFilename,
xlExcelLinks

D2 is the week no. which obviously increases by one each
week. The spreadsheet has numerous links to two other
sheets which i alter by using ChangeLink.

This has been working fine until recently when i created
copies of the spreadsheet for other sites. Now i get an
error saying "Object 'ChangeLink' of Object'_Workbook'
failed.
If i go back to my original spreadsheet there is no
problem, can anyone tell me what's going on?

Cheers

Joe

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

First thing I would look at is that the file names you are building are
valid paths/filenames in the context of the machines having the problems.

Also, what version of excel and how is the code triggered. If in Excel 97
using a commandbutton, you should try changing the takefocusonclick property
to false.

--
Regards,
Tom Ogilvy


"Joe Bannister" wrote in message
...
Hello,

I am using the following code:


secondFilename = "C:\"
secondFilename = secondFilename & CStr(Range("D2").Value)
secondFilename = secondFilename & "_04_siteadutysheet.xls"

thirdFilename = "C:\"
thirdFilename = thirdFilename & CStr(Range("D2").Value)
thirdFilename = thirdFilename & "_04_siteatills.xls"

Range("U1").Select
Selection.Copy
Range("D2").Select
Selection.pastespecial Paste:=xlPasteValues,
Operation:=xlAdd, SkipBlanks:=False, Transpose:=False
Range("V1").Select
Selection.Copy
Range("R2").Select
Selection.pastespecial Paste:=xlPasteValues,
Operation:=xlAdd, SkipBlanks:=False, Transpose:=False

fourthFilename = "C:\"
fourthFilename = fourthFilename & CStr(Range("D2").Value)
fourthFilename = fourthFilename & "_04_siteadutysheet.xls"

ActiveWorkbook.ChangeLink secondFilename, fourthFilename,
xlExcelLinks

fifthFilename = "C:\"
fifthFilename = fifthFilename & CStr(Range("D2").Value)
fifthFilename = fifthFilename & "_04_siteatills.xls"

ActiveWorkbook.ChangeLink thirdFilename, fifthFilename,
xlExcelLinks

D2 is the week no. which obviously increases by one each
week. The spreadsheet has numerous links to two other
sheets which i alter by using ChangeLink.

This has been working fine until recently when i created
copies of the spreadsheet for other sites. Now i get an
error saying "Object 'ChangeLink' of Object'_Workbook'
failed.
If i go back to my original spreadsheet there is no
problem, can anyone tell me what's going on?

Cheers

Joe



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
ChangeLink command Abdul Salam Excel Programming 0 July 14th 03 10:13 AM
ChangeLink xlExcelLinks Joe Bannister Excel Programming 0 July 10th 03 04:20 PM


All times are GMT +1. The time now is 11:19 AM.

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"