VBA: problems in creating and storing objects in array with loop

I created a Class named Issue. Then I created a function that creates Issue objects, set their properties with data from a worksheet and store them into a variant array through a loop. the problem is that everytime that the loops runs it overwrites the properties
of the same object instead of creating a new object, setting its properties. Would anyone know how to solve that? The loop code goes below:
 'Stores all the Issues objects in an Array
Function StoreAllIssues() As Variant
Dim IssuesSheet As Worksheet
Set IssuesSheet = Sheet1
Dim intLastRow As Integer
intLastRow = Uteis_Jorge.LastRowFunc(IssuesSheet, 1)
Dim IssuesArray() As New Issue: ReDim IssuesArray(0)
For i = 2 To intLastRow
    Dim MyIssue As New Issue
    MyIssue.IssueName = IssuesSheet.Cells(i, 1)
    MyIssue.Suggestion = IssuesSheet.Cells(i, 2)
    MyIssue.Priority = IssuesSheet.Cells(i, 3)
    MyIssue.Resolution = IssuesSheet.Cells(i, 4)
    MyIssue.JobStatus = IssuesSheet.Cells(i, 5)
    MyIssue.AssignedTo = IssuesSheet.Cells(i, 6)
    Set IssuesArray(i - 2) = MyIssue
    ReDim Preserve IssuesArray(i - 1)
Next i
ReDim Preserve IssuesArray(i - 3)
StoreAllIssues = IssuesArray
End Function
Jorge Barbi Martins ([email protected])

Hi Jorge,
You can set the MyIssue to Nothing every time you don't use the MyIssue object, in this way, the array will properly store the new MyIssue object:
For i = 2 To intLastRow
Dim MyIssue As New Issue
MyIssue.IssueName=IssuesSheet.Cells(i,1)
Set IssuesArray(i - 2) = MyIssue
ReDim Preserve IssuesArray(i - 1)
Set MyIssue = Nothing
Next i
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Problems in creating and storing new documents using BAPI_DOCUMENT_CREATE2

    Hi experts,
    I'm getting problems in creating and storing new documents using BAPI_DOCUMENT_CREATE2.
    I have a scenario where is defined the document type ZC1, document part 200, authorization group 0002 and for all of these  documents the storage category "Cofre DMS1". And the status which demands the storage category is 'FR'.
    I've been fullfiling the BAPI_DOCUMENT_CREATE2 in this way:
    "Tables
    data: it_doc like bapi_doc_draw2,
          it_return like bapiret2,
          it_files like bapi_doc_files2 occurs 0 with header line,
          it_objs like bapi_doc_drad occurs 0 with header line.
    "Variables
    data: wl_doctype like bapi_doc_draw2-documenttype,
          wl_docnumber like bapi_doc_draw2-documentnumber,
          wl_docpart like bapi_doc_draw2-documentpart,
          wl_docversion like bapi_doc_draw2-documentversion.
    it_doc-documenttype = 'ZC1'.
    it_doc-documentpart = '200'.
    it_doc-documentversion = '00'.
    it_doc-description = 'Test of documents creation via BAPI'.
    it_doc-username = sy-uname.
    it_doc-statusextern = 'FR'.
    it_doc-authoritygroup = '0002'.
    refresh it_files[].
    clear it_files.
    it_files-originaltype = '1'.
    it_files-storagecategory = 'Cofre DMS1'.
    it_files-wsapplication = 'PDF'.
    it_files-docfile = 'c:\110307.pdf'.
    it_files-description = 'Test file'.
    append it_files.
    refresh it_objs[].
    clear it_objs.
    it_objs-objecttype = 'EKPO'.
    it_objs-objectkey = '47000497600010'.
    append it_objs.
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
        documentdata = it_doc
      IMPORTING
        documenttype = wl_doctype
        documentnumber = wl_docnumber
        documentpart = wl_docpart
        documentversion = wl_docversion
        return = it_return
      TABLES
        objectlinks = it_objs
        documentfiles = it_files.
    After execute the BAPI process I got the following error:
    E26 087 - Data carrier COFRE DMS1 not defined
    Does anybody have a sugestion to help me, please?
    Thks
    David
    Edited by: David Tsutsui on Mar 18, 2010 10:52 AM

    Please refer to this thread, it tells why you need a data carrier you can also configure the same in DC20.
    Data Carriers for Storage the Originals of DMS

  • Problem in Creating and Scheduling an ODI Scenario

    Hi,
    while Creating and Scheduling an ODI Scenario with the help of the following link:
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/creating_scheduling_scenario/creating_scheduling_scenario.htm#t2
    Oracle DI Agent is not listed in services window(Start>Control Panel>Administrative Tools > Services).
    What shall I do?
    please tell me.And in addition please tell me the use of the Oracle DI Agent and why should we stop its service before creating the schedule??
    Thanks
    Anindya

    Please also look into this link http://odiexperts.com/agent/
    First of all did you got any Error why creating Agent Server else the agent service should be visible.
    Else please try this step.
    Update Odiparams
    agentservice -i -s <agent_name>
    Go and look for Services starting with Oracledi_Agent_<agentNAME> and start it  Finally test the agent and you should be able to schedule.
    you dont need to stop the Agent for every new Schedule, but you will need to right click on Agent and click on Update Scheduling -http://odiexperts.com/scheduling-using-odi-scheduler/
    If you are getting an error please provide us the error info and step at which you got the error.

  • Having trouble converting array to spreadsheet string, storing the file and coverting back to array with complex numbers

    I am working with a network analyzer. I have arrays made of 5 columns the first consisting of an integer and the next four consisting of complex numbers. I am converting the array into a spreadsheet string and then saving the file using the write characters to a file VI. That seems to work well as when I open the file in Excel all the data is there. However when I try to reverse the process, open file and convert back to array, I loose some of the data. Specifically the imaginary parts of my complex numbers are all going to zero. I have narrowed down the problem to be in the conversion from spreadsheet string to array and vice versa. I
    think the problem may be with the 'format' input to the VI. I do not have an adequate resource for this so I am not sure what to put in to accomplish my task. Any takers?

    Hi Biz
    I don't think there is a direct way of converting a complex number to a
    string, so when you convert the array to a spreadsheet string, the
    numbers would be converted to real data.
    However, you could try separating the real and imaginary parts using the
    "Numeric: Complex to Re/Im" function, and then store these - either in
    separate files or in adjacent columns/rows in the same file. Then, when
    you read in the data again, use the "Numeric: Re/Im to Complex" function
    to put the two "halves" together.
    If you actually want Excel to interpret the numbers as imaginary, then
    you'll probably want to create a string for each complex number of the
    form "Re + Im*i" (after separating the Re and Im parts), by using
    "String:Format into String" with 2 numeric inputs and the format string
    "%f+%fi".
    Reading the data back into Labview then would require splitting the
    string into the 2 pieces by using "Stringcan from String" with 2
    numeric outputs (smae precision as original numbers specified by the 2
    Default Value inputs) and the same format string "%f+%fi", and then using
    the above-mentioned "Numeric: Re/Im to Complex" function. It worked for
    me, so if you can't follow what I am describing, send me an email and I
    can email you what I did (LV 5.1.1).
    Paul
    Biz wrote:
    > Having trouble converting array to spreadsheet string, storing the
    > file and coverting back to array with complex numbers
    >
    > I am working with a network analyzer. I have arrays made of 5 columns
    > the first consisting of an integer and the next four consisting of
    > complex numbers. I am converting the array into a spreadsheet string
    > and then saving the file using the write characters to a file VI. That
    > seems to work well as when I open the file in Excel all the data is
    > there. However when I try to reverse the process, open file and
    > convert back to array, I loose some of the data. Specifically the
    > imaginary parts of my complex numbers are all going to zero. I have
    > narrowed down the problem to be in the conversion from spreadsheet
    > string to array and vice versa. I think the problem may be with the
    > 'format' input to the VI. I do not have an adequate resource for this
    > so I am not sure what to put in to accomplish my task. Any takers?
    Research Assistant
    School of Physiotherapy, Curtin University of Technology
    Selby Street, Shenton Park, Western Australia, Australia. 6008
    email: [email protected]
    Tel. +61 8 9266 4657 Fax. +61 8 9266 3699
    "Everyone who calls on the name of the Lord will be saved." Romans 10:12
    "For all have sinned and fall short of the glory of God, and are
    justified freely by his grace through the redemption that came by Christ
    Jesus." Romans 3:23-4

  • Has anybody tried creating and validating a XML doc with XML Schema?

    Hi,
    Has anybody tried creating and validating a XML doc with XML Schema?

    With XMLBeans, an XML document may be created from and validated with an XML schema.

  • My computer continually asks me to enter my password for Keychain access. This problem is continuos and I am having trouble with eliminating it. I have changed my password through Security and my Accounts numerous times to no avail.  Is there anythin

    My computer continually asks me to enter my password for Keychain access. This problem is continuos and I am having trouble with eliminating it.
    I have changed my password through Security and my Accounts numerous times to no avail.
    Is there anything I can do other than Resetting the entire computer and re installing all of the software, apps, etc.etc.

    Back up all data before proceeding.
    Launch the Keychain Access application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    Select the login keychain from the list on the left side of the Keychain Access window. If your default keychain has a different name, select that.
    If the lock icon in the top left corner of the window shows that the keychain is locked, click to unlock it. You'll be prompted for the keychain password, which is the same as your login password, unless you've changed it.
    Right-click or control-click the login entry in the list. From the menu that pops up, select
              Change Settings for Keychain "login"
    In the sheet that opens, uncheck both boxes, if not already unchecked.
    From the menu bar, select
              Keychain Access ▹ Preferences... ▹ First Aid
    There are four checkboxes in the window that opens. Check all of them. if they're not already checked. Close the window.
    Select
              Keychain Access ▹ Keychain First Aid
    from the menu bar and repair the keychain. Quit Keychain Access.
    If you use iCloud Keychain, open the iCloud preference pane and uncheck the Keychain box. You'll be prompted to delete the local iCloud keychain. Confirm. Then re-check the box. Follow one of the procedures described in this support article to set up iCloud Keychain on an additional device.

  • Problem in creating a callable object of type Business Logic

    Hi SDN,
    I am trying to create a callable object of type Business Logic in CE.
    When I give all information and click Next, I get this error message.
    Error while loading configuration dialog: Failed to create delegate for component com.sap.caf.eu.gp.ui.co.CExpConfig. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
    Can anybody help me out with this problem.
    Regards,
    Sumangala

    Hi.
    I'm having the same problem as Senthil in NW2004s SP15 with my application service and methods not showing up in the Callable Object wizard for Composite Application Services after I choose the Endpoint.  The only application name that shows up in the wizard is caf.tc, and the only service names that show up for it are LDDataAccessor, Metadata, and PropPermissionService.
    My IDE is on one machine and the application server I deploy to is located on a different machine.  My endpoint to the remote application server looks to be correctly configured.  The Composite Application Service seems to be deployed properly as I'm able to see it and test that it works in the Web Services Navigator <http://remotehost:50000/wsnavigator/>
    My deployed application service is a remote enabled service and is also web services enabled as well.
    I'm not sure if this is relevant, but I noticed that the generated Java code does not create any remote EJB interfaces (only home and local interfaces were generated).
    Something else I noticed is that when I proceed to the External Service Configuration -> Business Entities screen <http://remotehost:50000/webdynpro/dispatcher/sap.com/cafUIconfiguration>, I only see three business entities displayed, and the following error message is displayed: "Corrupt metadata has been detected. This may prevent some objects from being displayed. Check the server log for more details."  I was unable to find anything in the instance log files.  Is the error message indicative of the problem?
    I am developing locally without a NetWeaver Development Infrastructure (NWDI) in place.
    I'm wondering if the credentials specified in the endpoint require any special roles or privileges.
    Senthil, do any of these additional descriptions apply to you as well?
    Edited by: Ric Leeds on Jun 20, 2008 4:37 PM

  • Problem of create an Image object ?

    Dear all :
    the following code does not work when i use it in the application rather than in the applet :
    Image img = createImage(new MemoryImageSource(org_width,org_height,palette,0,org_width));
    where org_width , org_height is an int , while palette is an int[] that contain the pixels data in an application .
    So i then tried to create the ImageProducer object :
    ImageProducer ip = new MemoryImageSource(org_width,org_height,palette,0,org_width);
    But how can i create an Image object using the ImageProducer in an application ? Or any ways to create an Image object using the int [] pixel data in an application ?

    Hi
    I don't know if this is what your looking for, but I had the same problem, and it helped me, so why not try looking at it
    http://forum.java.sun.com/thread.jsp?forum=31&thread=167305
    Aagaard

  • Problems in creating RLANG stored procedure in HANA studio

    Hi,
    While I am creating a stored procedure (using .hdbprocedure file) in HANA studio with language as RLANG, I am getting an error message like this: "It is not supported to use another language than sqlscript".
    I have the following setting configured.
    HANA System -> Administration -> Configuration ->indexserver.ini -> repository -> sqlscript_mode = UNSECURE
    Any clues will be appreciated.
    Best Regards
    Surya

    HI Raj,
    This happens even for the empty procedure as following
    PROCEDURE "IDMANALYTICS_OPER"."idmanalytics.hana.db.hdbprocedures::MC_ROLEMINING_CLUSTERING_R" ( )
      LANGUAGE RLANG
      SQL SECURITY INVOKER
      READS SQL DATA AS
    BEGIN
      Write your procedure logic
    END;
    The procedure that I wanted to write is following.
    PROCEDURE MC_ROLEMINING_CLUSTERING_R(IN rolemining_input "_SYS_BIC"."idmanalytics.hana.db.views/MC_ROLEMINING_VINPUT",
      IN params "IDMANALYTICS_DB"."idmanalytics.hana.db.hdbtables::MC_ROLEMINING_PARAMETER",
      OUT result MC_ROLEMINING_CLUSTERS_TYPE,
      OUT result_hierarchy MC_ROLEMINING_HIERARCHY_TYPE,
      OUT result_userorder MC_ROLEMINING_USERORDER_TYPE
    LANGUAGE RLANG AS
    BEGIN
      noofclusters <- params$INT_VALUE[1];
      simindex <- params$DOUBLE_VALUE[2];
      distancemethod="jaccard"
      clusteringmethod="complete"
      usercol <- rolemining_input$USER_ID
      privcol <- rolemining_input$PRIV_ID
      #--generate user-permission matrix from user-permission table
      uptable <- data.frame(users = usercol, privileges = privcol)
      uniqueusers <- sort(unique(uptable$users))
      uniqueprivileges <- sort(unique(uptable$privileges))
      upmatrixdata <- vector()
      index <- 0
      for(i in uniqueusers )
      for(j in uniqueprivileges) {
      row_to_find <- data.frame(users=i, privileges = j)
      if(duplicated(rbind(uptable, row_to_find))[nrow(uptable)+1]){
      upmatrixdata <- append(upmatrixdata, 1, after = index)
      else {
      upmatrixdata <- append(upmatrixdata, 0, after = index)
      index <- index +1
      upmatrix <- matrix(
      upmatrixdata ,
      nrow = length(uniqueusers),
      ncol = length(uniqueprivileges),
      byrow = TRUE,
              dimnames = list(
              uniqueusers,
                  uniqueprivileges
      #--apply hierarchical clustersing
      require(vegan)
      distance<-vegdist(upmatrix,method=distancemethod)
      clusters<-hclust(distance,method=clusteringmethod)
      #--fill clusters for given h and k
      if(noofclusters > 0){
      userclusters<-cutree(clusters,k=noofclusters)
      tempresult <- as.data.frame(userclusters)
      result <- data.frame(USER_ID=row.names(tempresult), CLUSTER_ID=tempresult$userclusters)
      if(noofclusters <= 0 & simindex >= 0){
      userclusters<-cutree(clusters,h=simindex)
      tempresult <- as.data.frame(userclusters)
      result <- data.frame(USER_ID=row.names(tempresult), CLUSTER_ID=tempresult$userclusters)
      #--fill role hierarchy
      clusters_merge <- as.data.frame(clusters$merge)
      clusters_height <- clusters$height
      clusters_order <- clusters$order
      result_hierarchy <- data.frame(HEIGHT=clusters_height, V1=clusters_merge$V1, V2=clusters_merge$V2)
      #--fill user order
      clusters_order <- clusters$order
      result_userorder <- data.frame(USERORDER=clusters_order)
    END;

  • Problem in creating and updating of  material by the use of bapi and bdc

    Hello All,
    I am using bapi (BAPI_MATERIAL_SAVEDATA ) and than bdc to create and update classification data of material.
    I am facing a problem.
    1) firstly I am creating material by the use of bapi and than after creation i want to update classification data for taht perticular material .
    2) To update classification data i am using bdc . while at the time of updating material through bdc system showing me error that material is currently locked by user (my login name ).
    Please suggest what to do.
    Tkank you
    With Regards
    Shantanu Modi

    When u update/create data it takes sometime to commit. So after using BAPI
    give 10 minutes wait in ur program before updating classification data.
    you can write like
    wait up to 20 seconds.
    and update the classification.

  • Problem in creating No. Range Object

    HI All,
    I have one ztable ZDESIGN having fields
    NFDESIGN
    DEPT
    MACH_TYPE
    MATNR
    CODE
    CUST_NM
    MACH_NO
    MAKTX
    NETWORK_NO
    QTY
    MOD_CODE
    STATUS
    DVER
    IMPL
    PART_ST
    RELBY
    RELDT
    i want to store the number in code field on save. but i want to add many records at one time.
    while creating number range object(SNRO) , foll error is coming
    Table ZDESIGN may have only the no.range el.field and the subobject as a key
    how create number range object.
    Thanks

    Hi Kushi,
    Number ranges are not meant for initialization.
    you need to use subobjects which allows you to create number range values for example based on the month.
    you need not to increase the number every time.
    the FM gives you increased number every time.
    as i said earlier create entries in SCARR table. carrid values like 01 02 03 04 -- 10 11 12 ETC.
    12 sub objects for 12 months.
    then go to SNRO tcode and create the values for each month.
    in the program
    data date type sy-datum.
    month(2)  type c.
    month = sy-datum+3(2) will give you the current month.
    pass this to the FM NUMBER_GET_NEXT
    along with other parameters.
    hope this is clear to you.
    regards
    Ramchander Rao.K

  • Error when trying to create a new object that begins with Z

    Hi forum,
    When I try to create a new BW object that begins with Z (infofuente, infoarea, component application), I skip the following error.
    Namespace''is not a valid namespace BI
    Message no. R7017
    Diagnosis
    Namespace''must be entered in both the BI RSNSPACE table and the basic table TRSNSPACE or the view V_TRNSPACE. You also have to enter the relevant generation namespace '& V2' in TRNSPACE table. This value is taken from table RSNSPACE.
    Both namespaces must be set to 'Changeable' - providing they are not empty.
    Response System
    You can not edit or create an object in this namespace.
    Procedure
    Use a different name.
    Or contacct your system administrator. He / she can switch to the namespaces' Changeable 'using SE06 transaction, or - if they do not already exist - enter them in the table above named using sm30 transaction.
    If the namespace '& V1' is empty, then the problem is with the generation namespace '/ BIC /'.
    Procedure for System Administration
    I've been following steps said to me, and yet I still persisted error. I am probably missing something ... that may be?
    A greeting,

    Hi,
    Try to create the objects again and take the screenshot of SU53 when you get the error and see the authorization object for which you are getting the error here.
    It is possible that you dont have development authorization.
    Also the issue could be that the system is not configured to create the objects begining with Z.
    Check this with basis as well.
    Thanks
    Ajeet

  • TS1702 I purchased 2 packages of gems for skylanders and only received 1 package. Got email receipts and tried to report problem on ipad2 and it keeps coming up with to many https redirects. Can anyone help? Just want my gems :).

    I purchased 2 packages of gems for skylanders and only received 1 package. Got email receipts and tried to report problem with link in email on my ipad2 and it keeps coming up with to many https redirects. Can anyone help? Just want my gems :).

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Unable to create a Driver object from driver with Media type string CTC PHO

    Hi All,
    I am trying to develop a siebel cti adapter for avaya.
    I have loaded a custom dll into siebel server but it is throwing error "SBL-CSR-00500: Unable to create a Driver object from driver C:\Mydriver\cti.dll with Media-Type-String CTC Phone ".
    It has been long time without any progress.
    Please help
    Thanks
    Nishant

    Hi tomhowell,
    According to your description, my understanding is that you got an error when you created a site from a custom site template after migrading SharePoint 2010 to your server.
    Did you have the original solution file of the site template? Please re-deploy the solution to your SharePoint site, then create a site from the new site template, compare the result.
    Also use  SPDisposeCheck to indentify the memory leak:
    http://archive.msdn.microsoft.com/SPDisposeCheck
    http://www.fewlines4biju.com/2012/11/detected-use-of-sprequest-for.html
    Here are some similar posts for your reference:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3a25eb86-8415-4053-b319-9dd84a1fd71f/detected-use-of-sprequest-for-previously-closed-spweb-object-please-close-spweb-objects-when-you?forum=sharepointdevelopmentprevious
    http://social.msdn.microsoft.com/Forums/en-US/50ce964f-94a6-4fda-abc0-caa34e7111f1/error-detected-use-of-sprequest-for-previously-closed-spweb-object-occurs-when-new-site-gallery
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • How to create and destroy dynamically an array

    How to create an array of container dynamically and destroy it. I have an array of container which is to be sorted by comparision, but in sorting out the elements i want to delete some of the elements based on comparision.I run a for loop based on the number of elements in the array to be sorted. So what i do is take the elements into another array which i want to create it dynamically and reassign the new array back to the old one after sorting and delete it.

    Hi kpraveen,
    Maybe this thread helps,
    http://forums.ni.com/ni/board/message?board.id=330&message.id=18421&query.id=288653#M18421
    Greetings
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Kudos button (Gold Star) and see what happens =s=i=g=n=a=t=u=r=e=
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

Maybe you are looking for

  • Settings Screen is shaking sometimes

    When I am switching the app ,from some app to Settings ,the screen is shaking including the parent layout fastly/(From left to right).This behaviour is very critical.

  • HP Photosmart c410 won't print magenta after I cleaned the printhead

    I recently tried printing a document but the black came out faded, even though I had a lot of black ink left. This has happened before so I figured I needed to clean out the printhead to clear up any gunk stuck inside. I rinsed the printhead out and

  • IMAC won't start up with newly installed 4gb of RAM.

    I just bought 2x 2gb (4gb) of RAM for my IMAC 7,1 model and my computer will not start up now.  I have tried the old RAM again and it starts right up.  I assuming it is not compatible, but I don't know why.  They seem to be meeting specs for this sys

  • ASA Context Aware Security (CX) Vs URL filetering (websense)

    Fellas, I'm new to ASA and PIX. I have PIX with websense for URL filtering. We are upgrading to ASA 5585-X wih CX context aware module. Will I still be needing Websense, since we have CX. What would be the best soultions? Thanks in Advance. Happy New

  • How to catch cell lost focuse event of matrix

    Dear all can you tell me how to catch the cell lost fouc event of matrix. i want to check the value is entered the that cell, which is not greter than the extising value.. thanks in advance......