以模板格式将超链接从 Excel 复制到 Powerpoint

Copying Hyperlink from Excel to Powerpoint in a template format

我正在尝试以一种格式将一些数据从 Excel 复制到 PowerPoint。数据正在作为图片复制到 powerpoint。 Data中有一个字段是一个超链接,我想提取这个url并将url修改为图片,这样当我们点击图片时它会被重定向到修改后的url.

我可以使用以下代码将数据从 Excel 复制到 Powerpoint,但无法找到从数据超链接中提取 url 并将 url 修改为图片正在粘贴到 Powerpoint

Sub Generate_RC_All_PPTs()
Dim myFile, Fileselected As String, Path As String, objPPT As Object
Dim ppApp   As PowerPoint.Application
Dim ppPres  As PowerPoint.Presentation
Dim activeSlide As PowerPoint.Slide
Set ppApp = New PowerPoint.Application
 ppApp.Presentations.Open 
Filename:="C:\Release_Review\EBU_ReleaseReviewReport.pptx"

Dim j As Long
Worksheets("RC").Select
  NumRows = Range("A1", Range("A1").End(xlDown)).Rows.Count
 Range("A1").Select
  ' Establish "For" loop to loop "numrows" number of times.
  For j = 1 To NumRows - 1
  Worksheets("RC").Select
     ActiveCell.Offset(1, 0).Select
     ActiveCell.Copy
Worksheets("Release Commit - All Slides").Select

     Range("U1").Select
     'Selection.Paste
         Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, 
SkipBlanks _
    :=False, Transpose:=False

Application.ScreenUpdating = False

Set ppPres = ppApp.Presentations.Item(1)

ppPres.Slides(1).Copy
ppPres.Slides.Paste Index:=ppPres.Slides.Count + 1

Set activeSlide = ppPres.Slides(ppPres.Slides.Count)

activeSlide.Select
'Step 4: Copy the range as a picture
  Sheets("Release Commit - All Slides").Range("A3:Q29").CopyPicture
  DoEvents

'Step 5: Paste the picture
activeSlide.Shapes.Paste.Select
 Next
ppApp.Activate

Set activeSlide = Nothing
Set ppPres = Nothing
Set ppApp = Nothing

End Sub

来自 excel 的数据正在以图像格式复制到 Powerpoint。我想修改url到正在复制到powerpoint的图片

听起来你只有 1 个超链接,所以下面的应该有效。如果超过 1 个,则必须遍历 Hyperlinks 集合才能找到正确的链接。在从 Excel 收集数据的顶部部分,添加:

Dim HLink$
HLink$ = ActiveSheet.Hyperlinks(1)

然后在 PowerPoint 部分,在 activeSlide.Shapes.Paste.Select 之后添加:

With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick)
  .Action = ppActionHyperlink
  .Hyperlink.Address = HLink$
End With