You didn't say which version of OpenOffice you're using. In the current version there is no support for VBA (as far as I know). So the macro compiler doesn't understand what you mean by Excle.ActiveWorkbook.Worksheets(1).

Arnold Huzen




Matteo Rancilio schreef:
Hi,

I'm trying to run an excel macro in openoffice. The macro is very simple
but i get an error here > Set wk = Excel.ActiveWorkbook.Worksheets(1)

Could someone be so kind to help me in this?



Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Option Explicit

Sub convertiData()
'
' ConvertiData Macro
' Macro elaborata il 10/09/2003 da Tesmedia
'
'
Dim valore
Dim rowsTot
Dim tmp
Dim wk As Worksheet
Dim a
Dim b

Set wk = Excel.ActiveWorkbook.Worksheets(1)

rowsTot = 0
For a = 1 To 65536
valore = wk.Cells(a, 1).Text
If valore = "" Then Exit For
rowsTot = rowsTot + 1
Next a

For a = 1 To rowsTot
b = 4
Do While b <> 0
tmp = wk.Cells(a, b).Text
If tmp <> "" Then
tmp = "'" & tmp
wk.Cells(a, b).Value = tmp
End If

If b = 4 Then
b = 5
ElseIf b = 5 Then
b = 8
ElseIf b = 8 Then
b = 10
ElseIf b = 10 Then
b = 0
End If

Loop
Next a


End Sub



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to