|
-
Jun 13th, 2012, 01:59 AM
#1
Thread Starter
Junior Member
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
-
Jun 13th, 2012, 04:08 AM
#2
Re: How to Print this array in word?
change this line, just vbcrlf added
Code:
Selection.TypeText Text:="(" & AuthorName(N) & Year(N) & ")" & vbcrlf
-
Jun 13th, 2012, 04:14 AM
#3
Thread Starter
Junior Member
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
-
Jun 13th, 2012, 04:18 AM
#4
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.
-
Jun 13th, 2012, 04:21 AM
#5
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|