D
Diddy
Hi everyone,
I don't know what I'm doing wrong but this code stops at the changelink line
with a runtime error 1004.
I've checked in the locals window and the two strings are both as expected
and I put the msgbox in to check that the Activeworkbook was the one I wanted.
I've tried different types for the excel link type but now at a loss!
Here's the code
Option Explicit
Sub LinksChangeSource()
Dim stroldlink As String
Dim strnewlink As String
MsgBox "Select Original link Sourcexxx"
stroldlink = Application.GetOpenFilename("Excel files,*.xls")
MsgBox "Select workbook to change"
strnewlink = Application.GetOpenFilename("Excel files,*.xls")
MsgBox ActiveWorkbook.Name
'ActiveWorkbook.ChangeLink Name:=stroldlink, newname:=strnewlink,
Type:=xlLinkTypeOLELinks
ActiveWorkbook.ChangeLink Name:=stroldlink, newname:=strnewlink,
Type:=xlLinkTypeExcelLinks
'ActiveWorkbook.ChangeLink Name:=stroldlink, newname:=strnewlink,
Type:=xlExcelLinks
MsgBox "Done"
End Sub
If anyone can help I would be extremely grateful
BTW should I put underlines _ where the code breaks in these messages - just
in case anyone wants to try it out?
Thank you
I don't know what I'm doing wrong but this code stops at the changelink line
with a runtime error 1004.
I've checked in the locals window and the two strings are both as expected
and I put the msgbox in to check that the Activeworkbook was the one I wanted.
I've tried different types for the excel link type but now at a loss!
Here's the code
Option Explicit
Sub LinksChangeSource()
Dim stroldlink As String
Dim strnewlink As String
MsgBox "Select Original link Sourcexxx"
stroldlink = Application.GetOpenFilename("Excel files,*.xls")
MsgBox "Select workbook to change"
strnewlink = Application.GetOpenFilename("Excel files,*.xls")
MsgBox ActiveWorkbook.Name
'ActiveWorkbook.ChangeLink Name:=stroldlink, newname:=strnewlink,
Type:=xlLinkTypeOLELinks
ActiveWorkbook.ChangeLink Name:=stroldlink, newname:=strnewlink,
Type:=xlLinkTypeExcelLinks
'ActiveWorkbook.ChangeLink Name:=stroldlink, newname:=strnewlink,
Type:=xlExcelLinks
MsgBox "Done"
End Sub
If anyone can help I would be extremely grateful
BTW should I put underlines _ where the code breaks in these messages - just
in case anyone wants to try it out?
Thank you