Excel VBA:操作 Shockwave Flash 属性

发布于 2024-11-08 12:40:06 字数 884 浏览 1 评论 0原文

我正在开发一个小项目,在 Excel 中制作带有 YouTube 视频的“模因播放器” - 这是电子表格的屏幕截图

https://i.sstatic.net/VCfMu.jpg

我尝试的代码使用是 。

Option Explicit
Sub PlaySamsMemes()

Dim sChosenTitle As String
Dim rngVideoData As Range
Dim lFinalRow As Long
Dim sLookupValue As String

lFinalRow = Range("C65536").End(xlUp).Row
sChosenTitle = Range("F4").Value
Set rngVideoData = Range("B2:C" & lFinalRow)
sLookupValue = Application.VLookup(sChosenTitle, rngVideoData, 2, False)

Memeplayer.SetVariable("Movie", sLookupValue)

End Sub

如果您能告诉我如何让脚本与我在 Excel 界面中命名为“Memeplayer”的嵌入式 Shockwave Flash 完美配合,我将不胜感激 我用来尝试让它运行的行是:

Memeplayer.SetVariable("Movie", sLookupValue)

但它只返回一个“需要对象”错误(运行时错误 424)。我还没有太多地处理形状和物体,而且我不知道如何解决它。请帮助我!

I'm working on a little project to make a 'memeplayer' in Excel with YouTube videos - here's a screenshot of the spreadsheet

https://i.sstatic.net/VCfMu.jpg

The code I'm attempting to use is below:

Option Explicit
Sub PlaySamsMemes()

Dim sChosenTitle As String
Dim rngVideoData As Range
Dim lFinalRow As Long
Dim sLookupValue As String

lFinalRow = Range("C65536").End(xlUp).Row
sChosenTitle = Range("F4").Value
Set rngVideoData = Range("B2:C" & lFinalRow)
sLookupValue = Application.VLookup(sChosenTitle, rngVideoData, 2, False)

Memeplayer.SetVariable("Movie", sLookupValue)

End Sub

I'd be really grateful if you could tell me how to get the script to play nice with the embedded Shockwave Flash that I've named 'Memeplayer' in the Excel interface. The line I'm using to try and make it run is:

Memeplayer.SetVariable("Movie", sLookupValue)

but it just returns an 'Object required' error (Runtime Error 424). I've not worked with shapes and objects much as yet and I've no idea how to fix it. Help me please!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

段念尘 2024-11-15 12:40:06

我已经解决了这个问题。我只是没有正确设置对象 - 无法弄清楚它的层次结构。代码如下:

Set MemePlayer = Sheets(1).MemePlayer

MemePlayer.Movie = sLookupValue

I've since solved the problem. I just hadn't Set the Object correctly - couldn't figure out the heirachy for it. The code is below:

Set MemePlayer = Sheets(1).MemePlayer

MemePlayer.Movie = sLookupValue
等风来 2024-11-15 12:40:06

VBA 有很多限制,尝试在 Excel 中执行类似操作可能不是最好的方法。不过,这里有 2 个网站可能可以帮助您解决问题:

  1. http://chandoo.org/wp/2011/01/11/embed-youtube-videos-excel/ - 我认为这应该最有帮助
  2. http://www.cpearson.com/excel/DownloadFile.aspx (来自网站: http://www.pcreview.co.uk/forums/do-use-vba-play-sound-clip-website-t3893819.html

希望这会有所帮助。

VBA has many limitations and trying to do something like this in Excel is probably not the best way to go about it. However, here are 2 websites that might shed some light on your problem:

  1. http://chandoo.org/wp/2011/01/11/embed-youtube-videos-excel/ - this should help most I think
  2. http://www.cpearson.com/excel/DownloadFile.aspx (from the website: http://www.pcreview.co.uk/forums/do-use-vba-play-sound-clip-website-t3893819.html)

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文