VBA 到 Star Basic (OpenOffice),苦苦挣扎
Posted
技术标签:
【中文标题】VBA 到 Star Basic (OpenOffice),苦苦挣扎【英文标题】:VBA to Star Basic (OpenOffice), struggling 【发布时间】:2013-08-13 12:01:55 【问题描述】:我的任务是将最近编写的 VBA 代码转换为 OpenOffice 版本。我试图从 OpenOffice 启动它,但它不起作用(主要是“不满意的查询......”错误。我现在卡在打开文件对话框上,我可以使用 VBA 兼容的打开文件对话框,因为我现在看起来像那样(给出错误):
FileToOpen = Application.GetOpenFilename("Please choose a file to import", "Excel Files *.dbf (*.dbf)")
我也可以使用 OpenOffice 文件对话框,但找不到任何相关信息。
提前致谢
【问题讨论】:
你试过converter? 我已经尝试了 2 个我找到的转换器,但没有一个能正常工作。 【参考方案1】:我对您的要求感到困惑,但如果您在创建文件对话框时遇到问题,可以使用 VBA 代码为您解决问题。我想这就是你要问的,但我可能是错的。
Private Sub cmdFileDialog_Click()
' This requires a reference to the Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
' Clear the list box contents.
Me.FileList.Value = ""
' Set up the File dialog box.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
' Change allowmultiselect to true if you want them to be able to select multiple files
.AllowMultiSelect = False
' Set the title of the dialog box.
.Title = "Select One or More Files"
' Clear out the current filters, and then add your own.
.Filters.Clear
.Filters.Add "All Files", "*.*"
' Show the dialog box. If the .Show method returns True, the
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If .Show = True Then
' Loop through each file that is selected and then add it to the list box.
For Each varFile In .SelectedItems
Me.FileList.Value = varFile
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With
End Sub
【讨论】:
我想他是在问如何在 OpenOffice 中做同样的事情以上是关于VBA 到 Star Basic (OpenOffice),苦苦挣扎的主要内容,如果未能解决你的问题,请参考以下文章