Results 1 to 5 of 5

Thread: How to Print this array in word?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2012
    Posts
    22

    Unhappy How to Print this array in word?

    Hi all

    I have a two Input data of Year and Name in separate two arrays. I need to sort both the array values first i need to sort it chronologically(Year) and then if year information repeats it will sort the Array Alphabetically.

    As for as i complete the sorting for both year and then name. Using Wordbasic.sortarray command

    Input: (Before sorting)

    SDF 1997
    ELS 1986
    PJK 1983
    WKL 1995
    EFD 1986


    Output: (After sorting)

    PJK 1983
    EFD 1986
    ELS 1986
    WKL 1995
    SDF 1997

    if i print it in word it printed like this:


    PJK 1983, ELS 1986, EFD 1986, WKL 1995, SDF 1997.

    Here is my code for Printing the data. Would anyone please look into this and guide me where did i made mistake?

    WordBasic.sortarray SortyearArray()

    Code:
    Dim I As Integer
    Dim J As Integer
    Dim K As Integer
    Dim N As Integer
    Dim Counter As Integer '
    COUNTER1 = 1
    
    
    i1 = 1
    J1 = 5
    
    For I = 0 To UBound(SortyearArray())
    Counter = 1
    For J = I + 1 To UBound(SortyearArray())
    If SortyearArray(I) = SortyearArray(J) Then
    Counter = Counter + 1
    MsgBox (Counter)
    End If
    COUNTER1 = Counter + COUNTER1
    Next J
    If Counter = 1 Then
    For N = i1 To J1
    If SortyearArray(I) = Year(N) Then
    Selection.TypeText Text:="(" & AuthorName(N) & Year(N) & ")"
    End If
    Next N
    End If
    Next I

  2. #2
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: How to Print this array in word?

    change this line, just vbcrlf added
    Code:
    Selection.TypeText Text:="(" & AuthorName(N) & Year(N) & ")" & vbcrlf
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2012
    Posts
    22

    Re: How to Print this array in word?

    Nope. Ji, I dont want to print in a newline. I wanna print it into a single line it self.

    as i mentioned earlier

    PJK 1983, ELS 1986, EFD 1986, WKL 1995, SDF 1997.

    Similar year information 1986 is not printed in alphabet order.
    We need a output like

    PJK 1983, EFD 1986, ELS 1986, WKL 1995, SDF 1997.


    Regards,
    DeepakGopikannan

  4. #4
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: How to Print this array in word?

    thats the problem of sorting, then why u again start a new thread, this thread is look like just for printing a array, printing array is not ur problem, sorting array is the problem, so better start a new thread with clear title and info, so ppl can concider that.
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2012
    Posts
    22

    Re: How to Print this array in word?

    Okay, Thank you for your comment.


    Regards,
    DeepakGopikannan

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width