Without recoding, I don't believe that VB works in OOo. OOo has its
own native macro language - basic.

A good source of information on the language can be found here :
http://www.pitonyak.org/oo.php

/paul

On 11/16/06, ivan spajic <[EMAIL PROTECTED]> wrote:
Hi,

I've installed Open Office and really need to use a macro that works fine in
Excel to work fine in Calc as well.

Here is the info:
Microsoft XP professional, Version 2002, Service pack 2
I've installed the Java version: jre-1_5_0_09-windows-i586-p-s from
java.comsince I couldn't figure out what version I should download
from
java.sun.com by reading the release notes.
My Open Office version is 2.0.4
My Excel version is Microsoft Office Excel 2003

The macro code goes like this:

Option Explicit
Sub repeat_BxN_Col3()
   repeat_BxN (3)
End Sub

Sub repeat_BxN(Optional ColB As Long)
'Repeat row x Col B value  2003-08-22 in misc
  Dim wsSource As Worksheet
  Dim wsNew As Worksheet
  Set wsSource = ActiveSheet
  Dim rng As Range, rng2 As Range
  Dim vRows As Long, colBstr As String
  Dim I As Long
  If ColB = 0 Then
    On Error Resume Next
    ColB = InputBox("Which column has Repetition Count", _
      "Repetition", 2)
    If Err.Number <> 0 Then Exit Sub
    On Error GoTo 0
  End If
  Sheets(ActiveSheet.Name).Copy _
       Before:=Sheets(ActiveSheet.Name)
  Set wsNew = ActiveSheet
  Application.ScreenUpdating = False
  Application.Calculation = xlCalculationManual
  Set rng = Cells.Columns(ColB) _
        .SpecialCells(xlCellTypeConstants, 1)
  Dim A As Long
  For A = rng.Areas.Count To 1 Step -1
    For I = rng.Areas(A).Count To 1 Step -1
       Set rng2 = rng.Areas(A)(I).EntireRow
       vRows = rng2.Cells(1, ColB).Value
       rng2.Cells(1, ColB).Value = 1
       If vRows > 1 Then
        rng2.Resize(rowsize:=2).Rows(2).EntireRow. _
         Resize(rowsize:=vRows - 1).Insert Shift:=xlDown
       rng2.AutoFill rng2.Resize( _
         rowsize:=vRows), xlFillCopy
       End If
    Next I
  Next A
  Application.Calculation = xlCalculationAutomatic
  Application.ScreenUpdating = True
End Sub

The error that I get is this:
BASIC syntax error
Unknown data type Worksheet

The program highlights row 9 in the OpenOffice.org Basic, where the
Worksheet is mentioned.

The macro works perfectly in Excel.

Thanks a lot for your help

Ivan Spajić



--
Try Torpark; a small portable, open-source, built on Firefox browser
that enables anonymous browsing. Requires no installation :
http://www.torrify.com/

Reply via email to