我有一些excel VBA代码,它在Open Office Calc中不起作用。excel中的代码将文件从列表从不同的目录复制到另一个目录。
我不知道开放式办公室中的宏编程。我读到了不同的宣言,但这对我来说真的很难。对于开放式办公室,我应该改变什么?我将非常感谢任何帮助。
子复制文件((
Dim xRg As Range, xCell As Range
Dim xSFileDlg As FileDialog, xDFileDlg As FileDialog
Dim xSPathStr As Variant, xDPathStr As Variant
Dim xVal As String
On Error Resume Next
Set xRg = Application.InputBox("Wybierz pliki do skopiowania:", "KuTools For Excel", ActiveWindow.RangeSelection.Address, , , , , 8)
If xRg Is Nothing Then Exit Sub
Set xSFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
xSFileDlg.Title = "Wybierz folder z którego kopiuję:"
If xSFileDlg.Show <> -1 Then Exit Sub
xSPathStr = xSFileDlg.SelectedItems.Item(1) & ""
Set xDFileDlg = Application.FileDialog(msoFileDialogFolderPicker)
xDFileDlg.Title = "Wybierz folder do którego kopiuję:"
If xDFileDlg.Show <> -1 Then Exit Sub
xDPathStr = xDFileDlg.SelectedItems.Item(1) & ""
For Each xCell In xRg
xVal = xCell.Value
If TypeName(xVal) = "String" And xVal <> "" Then
FileCopy xSPathStr & xVal, xDPathStr & xVal
End If
Next
结束子
代码需要完全重写。OpenOffice Basic是一个与MS Office VBA完全不同的编程平台。
开始学习OpenOffice Basic的一个好地方是 http://www.pitonyak.org/oo.php。