我有一个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工作表
发布评论