0

我在幻灯片中添加了搜索功能。

我正在使用的代码是

If SearchTxt = "social networking" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 5
Slide52.SearchBox.Text = ""
End If

只是一遍又一遍地重复,所有的条款和幻灯片链接。有些条款不起作用。

完整代码:

Sub Search()

SearchTxt = LCase(Slide52.SearchBox.Text)

If SearchTxt = "social networking" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 5
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "internet browsers" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 6
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "domain name" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 7
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "protocol name" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 8
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "netiquette" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 9
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "http" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 10
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "pop3" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 11
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "smtp" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 12
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "html" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 13
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "rss" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 14
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "isp" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 15
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "router" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 16
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "modem" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 17
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "server" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 18
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "client" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 19
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "compressed files" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 20
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "tcp" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 21
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "ftp" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 22
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "cloud storage" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 23
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "firewall" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 24
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "packet switching" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 25
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "serial transmission" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 26
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "bi directional transmission" Or "bi-directional transmission" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 27
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "circuit switched transmission" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 28
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "ubiquitous computing" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 29
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "e-commerce" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 30
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "e commerce" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 30
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "data integrity" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 31
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "pinging" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 32
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "popup" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 33
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "pop up" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 33
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "voip" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 34
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "rfid" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 35
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "nap" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 36
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "ip" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 38
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "internet" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 39
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "www" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 40
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "bandwidth" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 41
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "transmission rate" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 42
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "imap" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 44
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "fibre optic" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 45
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "simplex" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 46
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "half duplex" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 48
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "full duplex" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 49
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "duplex" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 49
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "codec" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 50
Slide52.SearchBox.Text = ""
End If
If SearchTxt = "url" Then
ActivePresentation.SlideShowWindow.View.GotoSlide 43
Slide52.SearchBox.Text = ""
End If

End Sub
4

1 回答 1

0

如果您说明哪些条款无效,这将有所帮助。但是,此语法不正确:

If SearchTxt = "bi directional transmission" Or "bi-directional transmission" Then

并且应该是

If SearchTxt = "bi directional transmission" Or SearchTxt = "bi-directional transmission" Then

第一个版本将是 True ,这意味着下面的所有 if 都不会执行,因为搜索文本现在将是空白的。

于 2013-06-09T12:23:27.330 回答