通过VBA从Powerpoint打开特定的Excel工作表

编程入门 行业动态 更新时间:2024-10-10 03:22:27
本文介绍了通过VBA从Powerpoint打开特定的Excel工作表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个Power Point演示文稿,其中包含使用VBA从Excel粘贴到其中的数据.excel文件中的数据是一个表,其中包含指向同一工作簿中其他工作表的超链接.以此为例的VBA是:

I have a Power Point presentation that contains data pasted into it from Excel using VBA. The data in the excel file is a table that contains hyperlinks to other worksheets within the same workbook. The VBA that creates this as an example is :

'将超链接添加到用户可用于从PowerPoint查找的每个工作表

'Adds hyperlink to each worksheet user can use to find from powerpoint

Range("B2").Select ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _ "'Title Missing'!A1", TextToDisplay:="Missing Title Tags"

此代码工作得很好-宏然后将该表粘贴到Powerpoint中.我的问题是通过powerpoint文件查找的文件是错误的,正在查找名为

This code works just fine - The Macro then pastes this table into Powerpoint. My problem is the file it is looking for via the powerpoint file is wrong, it is looking for a file called

C:\Users\Colin\Desktop\Title Missing.xlsx`

.标题丢失"是工作表的名称,并且该路径是通过VBA生成的路径,尽管在单击VBA创建的链接时从一个工作表跳到另一个工作表时,该路径可以从Excel内部正常工作.

. "Title Missing" is the name of the worksheet and this path is the one being generated via the VBA despite the path working correctly from inside Excel when hopping from one worksheet to the other when clicking on the links the VBA creates.

如何从PowerPoint中获得指向正确工作表的链接?

How do I get the link to the right worksheet to work from within PowerPoint?

推荐答案

使用Address参数:

Use the Address parameter:

ActiveSheet.Hyperlinks.Add Anchor:=Selection, _ Address:=ActiveSheet.Parent.FullName, _ SubAddress:="'Title Missing'!A1", TextToDisplay:="Missing Title Tags"

更多推荐

通过VBA从Powerpoint打开特定的Excel工作表

本文发布于:2023-10-31 10:12:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545777.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   VBA   Powerpoint   Excel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!