Click here to Skip to main content
15,914,419 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Prepare Templates & Mail Pin
Trupti Mehta27-Aug-07 19:32
Trupti Mehta27-Aug-07 19:32 
GeneralRe: Prepare Templates & Mail Pin
Dave Kreskowiak28-Aug-07 1:30
mveDave Kreskowiak28-Aug-07 1:30 
GeneralRe: Prepare Templates & Mail Pin
Trupti Mehta28-Aug-07 1:55
Trupti Mehta28-Aug-07 1:55 
GeneralRe: Prepare Templates & Mail Pin
Dave Kreskowiak28-Aug-07 3:31
mveDave Kreskowiak28-Aug-07 3:31 
GeneralRe: Prepare Templates & Mail Pin
Trupti Mehta28-Aug-07 19:20
Trupti Mehta28-Aug-07 19:20 
GeneralRe: Prepare Templates & Mail Pin
Dave Kreskowiak29-Aug-07 12:32
mveDave Kreskowiak29-Aug-07 12:32 
GeneralRe: Prepare Templates & Mail Pin
Trupti Mehta4-Sep-07 23:14
Trupti Mehta4-Sep-07 23:14 
GeneralRe: Prepare Templates & Mail Pin
Dave Kreskowiak5-Sep-07 2:20
mveDave Kreskowiak5-Sep-07 2:20 
OK. So you have Word installed on the machine, since you're using it in your code.

Why are you even bothering with this?? The user can easily do the exact same thing in Word, using Word's own field and MialMerge features and have greater flexibility doing it!

You're code is opening an RTF file in Word and trying to use Word's MailMerge, which won't work because you're not using any field objects that Word needs to do mail merge.

Then your code does something really weird here:
Dim row As DataRow
For i = 0 To mDs.Tables(0).Rows().Count() - 1
    MsgBox("Row of " + myDG.Rows(i).Cells(1).ToString())
    If (myDG.Rows(i).Cells("Select").Selected() = True) Then
    ...

This says increment i from 0 to the number of rows in a DataTable object, but your index is looking at the rows in a DataGrid instead. Just get the data out of the DataRow object returned by:
mDs.Tables(0).Rows(i)

That gives you the DataRow with all the data in it.

You really need to scrap this code and start over, from the specifications. What you told me and what you've shown me are two VERY different things. I thought you were doing this in VB.NET with a RichTextBox and you've shown me VBA code, that's running in Word apparently.


A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: Prepare Templates & Mail Pin
Trupti Mehta5-Sep-07 4:09
Trupti Mehta5-Sep-07 4:09 
GeneralRe: Prepare Templates & Mail Pin
Dave Kreskowiak5-Sep-07 14:07
mveDave Kreskowiak5-Sep-07 14:07 
GeneralRe: Prepare Templates & Mail Pin
Trupti Mehta5-Sep-07 17:36
Trupti Mehta5-Sep-07 17:36 
GeneralRe: Prepare Templates & Mail Pin
Dave Kreskowiak6-Sep-07 1:37
mveDave Kreskowiak6-Sep-07 1:37 
GeneralRe: Prepare Templates & Mail Pin
Trupti Mehta6-Sep-07 17:31
Trupti Mehta6-Sep-07 17:31 
GeneralRe: Prepare Templates & Mail Pin
Dave Kreskowiak7-Sep-07 1:49
mveDave Kreskowiak7-Sep-07 1:49 
QuestionAutomate Excel Using vb 6.0 Pin
jamesrajesh27-Aug-07 1:31
jamesrajesh27-Aug-07 1:31 
AnswerRe: Automate Excel Using vb 6.0 Pin
Dave Kreskowiak27-Aug-07 5:42
mveDave Kreskowiak27-Aug-07 5:42 
Questionhow to write something "does not equal" something else. Pin
KOTO-G27-Aug-07 1:09
KOTO-G27-Aug-07 1:09 
AnswerRe: how to write something "does not equal" something else. Pin
Christian Graus27-Aug-07 1:58
protectorChristian Graus27-Aug-07 1:58 
GeneralRe: how to write something "does not equal" something else. Pin
jamilkhan00727-Aug-07 19:53
jamilkhan00727-Aug-07 19:53 
AnswerRe: how to write something "does not equal" something else. Pin
Johan Hakkesteegt30-Aug-07 0:09
Johan Hakkesteegt30-Aug-07 0:09 
QuestionError number description Pin
sacheesach27-Aug-07 0:53
sacheesach27-Aug-07 0:53 
AnswerRe: Error number description Pin
Dave Kreskowiak27-Aug-07 3:21
mveDave Kreskowiak27-Aug-07 3:21 
Questiondelegate Pin
Ahamed Azeem27-Aug-07 0:30
Ahamed Azeem27-Aug-07 0:30 
GeneralRe: delegate Pin
Christian Graus27-Aug-07 1:04
protectorChristian Graus27-Aug-07 1:04 
GeneralRe: delegate Pin
Ahamed Azeem27-Aug-07 1:37
Ahamed Azeem27-Aug-07 1:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.