vb调用word程序 vb.net 调用word
vb调用word
通过在打开之前进行窗口查找,如果查找成功,则调用SetWindowPos 置顶窗体,否则打开Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As LongPrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Const HWND_TOPMOST = -1Private Const SWP_NOMOVE = &H2Private Const SWP_NOSIZE = &H1Private Const SWP_SHOWWINDOW = &H40Private Sub Form_Load()Dim n As Long, m As LongDim sName As StringsName = "1.doc" & " - Microsoft Word" "这里的1.doc 改成你的文件名n = FindWindow(vbNullString, sName)If n 0 Thenm = SetWindowPos(n, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_SHOWWINDOW)Else"打开Word代码End IfEnd Sub
有没有专门讲解用VB调用Word并控制Word进行操作的书?
应该是没有的对于某个编程语言的某块调用翻来覆去最多也就是10几句20几句的指令,出一本书成本太大,购买的人又少,肯定不会出。
除非像数据库之类的东西这种东西应该在API的书或者专门讲ocx调用的书里会讲,但是ocx一直是个冷门还是建议百度吧
WORD中的VB编程能力如何?可以用WORD中的VB编各种程序吗
Pivate Declae Function ShellExecute Li "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOpeation As Sting, ByVal lpFile As Sting, ByVal lpPaametes As Sting, ByVal lpDiectoy As Sting, ByVal nShowCmd As Long) As Long Pivate Su Command1_Click() ShellExecute Me.hwnd, "Open", "D:\test.doc", "", App.Path, 1 End Su
-