Z
zhangqb2002
Hi guys,
I use Excel 2003 and Win XP. I have a macro to copy another workbook
sheet (SI) to current sheet (sheet2). The SI sheet has some hyperlinks
to PDF files saved in G drive. The problem is after I saved the file, I
can't open the hyperlinks. Does anyone know the reason? The following
is my code:
Private Sub CommandButton1_Click()
Dim wbCopy As Workbook
Dim wbCurrent As Workbook
Dim rngCopy As Range
Dim rngPaste As Range
Dim x
Dim sYourFilename As String
x = MsgBox("Do You Wish to Update?", vbYesNo, "Update?")
If x = vbYes Then
Set wbCurrent = ActiveWorkbook
'Replace with your filepath and name
sYourFilename = "e:\gam\datatest\datatest15.xls"
Application.ScreenUpdating = False
Workbooks.Open sYourFilename
Set wbCopy = ActiveWorkbook
Sheets("SI").Activate 'Replace with your sheet
name
Set rngCopy = ActiveSheet.UsedRange
wbCurrent.Activate
Set rngPaste = Sheets("sheet2").Range("A1")
rngCopy.Copy Destination:=rngPaste
wbCopy.Close
Application.ScreenUpdating = True
Set wbCurrent = Nothing
Set wbCopy = Nothing
End If
End Sub
TIA
Eric
I use Excel 2003 and Win XP. I have a macro to copy another workbook
sheet (SI) to current sheet (sheet2). The SI sheet has some hyperlinks
to PDF files saved in G drive. The problem is after I saved the file, I
can't open the hyperlinks. Does anyone know the reason? The following
is my code:
Private Sub CommandButton1_Click()
Dim wbCopy As Workbook
Dim wbCurrent As Workbook
Dim rngCopy As Range
Dim rngPaste As Range
Dim x
Dim sYourFilename As String
x = MsgBox("Do You Wish to Update?", vbYesNo, "Update?")
If x = vbYes Then
Set wbCurrent = ActiveWorkbook
'Replace with your filepath and name
sYourFilename = "e:\gam\datatest\datatest15.xls"
Application.ScreenUpdating = False
Workbooks.Open sYourFilename
Set wbCopy = ActiveWorkbook
Sheets("SI").Activate 'Replace with your sheet
name
Set rngCopy = ActiveSheet.UsedRange
wbCurrent.Activate
Set rngPaste = Sheets("sheet2").Range("A1")
rngCopy.Copy Destination:=rngPaste
wbCopy.Close
Application.ScreenUpdating = True
Set wbCurrent = Nothing
Set wbCopy = Nothing
End If
End Sub
TIA
Eric