Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 如何将OpenOffice文档窗口/Win32的内容替换为文档化的解决方案不起作用?_Vba_Openoffice.org_Openoffice Writer - Fatal编程技术网

Vba 如何将OpenOffice文档窗口/Win32的内容替换为文档化的解决方案不起作用?

Vba 如何将OpenOffice文档窗口/Win32的内容替换为文档化的解决方案不起作用?,vba,openoffice.org,openoffice-writer,Vba,Openoffice.org,Openoffice Writer,我正在使用OO 3.0,并根据官方openoffice文档()替换该文档,这是所需的代码: Dim Doc As Object Dim Dummy() Dim Url As String Dim SearchFlags As Long SearchFlags = com.sun.star.frame.FrameSearchFlag.CREATE + _ com.sun.star.frame.FrameSearchFlag.ALL Url = "file:///C:

我正在使用OO 3.0,并根据官方openoffice文档()替换该文档,这是所需的代码:

Dim Doc As Object
Dim Dummy() 
Dim Url As String
Dim SearchFlags As Long

SearchFlags = com.sun.star.frame.FrameSearchFlag.CREATE + _
              com.sun.star.frame.FrameSearchFlag.ALL
Url = "file:///C:/test.odt"
Doc = StarDesktop.loadComponentFromURL(Url, "MyFrame", SearchFlags, Dummy)
MsgBox "Press OK to display the second document."

Url = "file:///C:/test2.odt"
Doc = StarDesktop.loadComponentFromURL(Url, "MyFrame", SearchFlags, Dummy)
我试过了,但不起作用,从VB和OO Basic都试过了 我错过了什么?
(我使用所有标志23+8甚至55作为搜索标志掩码)

在阅读了更多示例脚本后,我尝试手动设置fame名称:

vFrame = ThisComponent.CurrentController.Frame 
REM Here we set the frame name manually 
vFrame.setName("MyFrame") 
虽然使用loadComponentFromURL似乎不会更改框架名称,但使用setName确实会更改框架名称,因此在第一次调用loadComponentFromURL后,我使用setName更改了框架,从现在起,它将按预期工作