OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

problem: assignment of user-defined types

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
spdfo
Newbie
Newbie


Joined: 29 Oct 2007
Posts: 3

PostPosted: Mon Oct 29, 2007 6:32 am    Post subject: problem: assignment of user-defined types Reply with quote

Hello, I need help with a basic problem. Where I work we have a tool written in Excel and VBA, that makes heavy use of user-defined types. I am trying to convert it to open office.org, but I encounter very basic problems with user-defined types. One of the problems is assigning between user-defined types. Here is a simple example that works in VBA but not in ooo :
Code:

Type myType
   s as String
   i as Integer
End Type

Sub Main

   Dim a(3) as myType
   Dim b as myType
   
   a(1).s = "aaa"
   a(1).i = 111
   a(2).s = "bbb"
   a(2).i = 222
   
   a(1) = a(2) ' does NOTHING in ooo
   MsgBox a(1).s   ' ooo prints 'aaa', VBA 'bbb'
   MsgBox a(1).i   ' ooo prints 111 VBA 222
   
   a(1).s = a(2).s 'works
   a(1).i = a(2).i 'works
   MsgBox a(1).s
   MsgBox a(1).i

End Sub


As you can see, the assignment a(1) = a(2) does nothing in ooo, but works in VBA. Assigning field by field seems to work. Is there a solution for assigning whole types without field-by-field assignment? I am using open office.org 2.3. Please help Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group