level 1
那啥...
ACFUN上面熊的宏源码每次执行它总是会说“编译错误。常数,固定长度字符串,数组,用户定义类型以及DECLARE语句不允许作为对象模块的公共成员.”
附带原始宏源码:
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub Play()
pages = ActiveDocument.BuiltInDocumentProperties(wdPropertyPages)
For i = 1 To pages-1
Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:=""
Sleep (85) '间隔时间,安需要修改
Next i
End Sub
应该是第一个语句错了...
有技术宅能够帮忙解决一下么...
挖鼻...
2009年12月26日 14点12分
1
level 1
声明:Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
库名:kernel32
说明:dwMilliseconds 必要参数,停顿的时间。单位:毫秒(ms)。
---------------------------------------------------
Java语言中Thread类中的函数 作用:程序暂停,延迟执行若干时间. 时间的长短由其参数决定 例如: try{ Thread.sleep(500); //休眠500毫秒}catch(InterruptedException e){ e.printStackTrace(); } 注意:sleep函数是静态函数,在执行时要抛出一个中断异常, 必须对其进行捕获并处理才可以使用这个函数
我没学过VB帮不鸟你- -
2009年12月26日 15点12分
6
level 1
请确认没有打多余的字符,我经常见到引起此类问题的原因是多了个啥标点符号
2009年12月26日 15点12分
7
level 0
Sleep和SetTimer都不够准确,建议用timeSetEvent
2009年12月28日 00点12分
9
level 5
Word2007运行通过没有问题
这是宏的VBA程序,不要在VB中调试
2009年12月28日 08点12分
12
level 1
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Declare Function SetTimer Lib "user32" (ByVal HWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Private Declare Function KillTimer Lib "user32" (ByVal HWnd As Long, ByVal nIDEvent As Long) As Long
Private runc As Integer
Private runcmax As Integer
Private HWnd As Long
Private thwnd As Long
Sub ykautoflip()
'bgm$ = InputBox("BGM的位置?")
'MsgBox bgm$
ps = ActiveDocument.ComputeStatistics(wdStatisticPages)
'MsgBox ps
runcmax = ps
'a = sndPlaySound(bgm$, 1)
PlaySound "D:\bgm.wav", 0, 1 Or &H20000
'For i = 1 To ps - 1
'Sleep (84)
'WordBasic.VPage
runc = 0
thwnd = SetTimer(0, 0&, 94, AddressOf TimerProc)
'Next
End Sub
Sub TimerProc(ByVal HWnd As Long, ByVal uMsg As Long, ByVal nIDEvent As Long, ByVal dwTimer As Long)
If runcmax < runc Then
KillTimer 0, HWnd
Exit Sub
End If
WordBasic.VPage
Debug.Print runc
runc = runc + 1
End Sub
Sub tk()
KillTimer 0, thwnd
End Sub
2009年12月29日 08点12分
16