Dear all,

looks like I am to stupid for this. I tried the following code

<code start>
Sub Main
        Dim Doc As Object
        Dim Sheet As Object
        Doc = StarDesktop.CurrentComponent 
        Sheet = Doc.Sheets(0)
        If Doc.Sheets.hasByName("TestRack") 
        Then Sheet = Doc.Sheets.getByName("TestRack") 
        Else Sheet = Doc.createInstance("com.sun.star.sheet.Spreadsheet") 
                Doc.Sheets.insertByName("TestRack", Sheet) 
        End If
End Sub
<code end>

and OpenOffice complains 
BASIC syntax error.
unexpected: Then .

When I change the code to so that I have all the line starting from If up to 
End If in one line than it complains about the Doc.Sheets.insertByName...

This makes no sense at all to me....

I even started to think about changing to Excel, as VBA seems to be much more 
straight forward to use. 

So any help welcome.

Guido

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

Antwort per Email an