Hello
I have been developing a resume builder database and based on criteria resume is being exported to word, exporting vba code as below what I see problem is that when there are two matching records found means two candidate resume should be exported to word, but when first export is finished the word writes few information of the second word document to first opened word document ( i.e resume record ) wherin ther is use of SELECT statment as stated below :
I am using wdapp.visible = false which keeps open the entire word document
here is the code of select which keeps overriding to one.
I am printing multiple text in one cell of table of word with different formating like Bold,italic ..
I have been developing a resume builder database and based on criteria resume is being exported to word, exporting vba code as below what I see problem is that when there are two matching records found means two candidate resume should be exported to word, but when first export is finished the word writes few information of the second word document to first opened word document ( i.e resume record ) wherin ther is use of SELECT statment as stated below :
I am using wdapp.visible = false which keeps open the entire word document
here is the code of select which keeps overriding to one.
Code:
If rsGetPosition.RecordCount <> 0 Then
While Not rsGetPosition.EOF
composite = "a) Company = " & rsGetPosition.Fields("Company Name").Value & vbCrLf
ActiveDocument.Tables(1).Cell(8, 1).Select
'Move to the right
Selection.Collapse Direction:=wdCollapseEnd
'Move back to the left
Selection.MoveLeft wdCharacter, 1
'Add the text (using the myText1 format)
Selection.Range.Text = composite
'Select the on word the right (myText2)
Selection.MoveRight Unit:=wdWord, Count:=Len("a) Company = " & rsGetPosition.Fields("Company Name").Value), Extend:=wdMove
'Format myText2
Selection.Range.Font.Underline = False
Selection.Range.Font.Bold = False
Selection.Range.Font.Size = 12
composite = ""
composite = "b) Position = " & rsGetPosition.Fields("Position").Value & vbCrLf
ActiveDocument.Tables(1).Cell(8, 1).Select
'Move to the right
Selection.Collapse Direction:=wdCollapseEnd
'Move back to the left
Selection.MoveLeft wdCharacter, 1
'Add the text (using the myText1 format)
Selection.Range.Text = composite
'Select the on word the right (myText2)
Selection.MoveRight Unit:=wdWord, Count:=Len("a) Position = " & rsGetPosition.Fields("Position").Value), Extend:=wdMove
'Format myText2
Selection.Range.Font.Underline = False
Selection.Range.Font.Bold = False
Selection.Range.Font.Size = 12
composite = ""
composite = "c) Dates = " & rsGetPosition.Fields("Date").Value & vbCrLf
ActiveDocument.Tables(1).Cell(8, 1).Select
'Move to the right
Selection.Collapse Direction:=wdCollapseEnd
'Move back to the left
Selection.MoveLeft wdCharacter, 1
'Add the text (using the myText1 format)
Selection.Range.Text = composite
'Select the on word the right (myText2)
Selection.MoveRight Unit:=wdWord, Count:=Len("c) Dates = " & rsGetPosition.Fields("Position").Value), Extend:=wdMove
'Format myText2
Selection.Range.Font.Underline = False
Selection.Range.Font.Bold = False
Selection.Range.Font.Size = 12
composite = ""
composite = "d) Serves As = " & rsGetPosition.Fields("Serves As").Value & vbCrLf
ActiveDocument.Tables(1).Cell(8, 1).Select
'Move to the right
Selection.Collapse Direction:=wdCollapseEnd
'Move back to the left
Selection.MoveLeft wdCharacter, 1
'Add the text (using the myText1 format)
Selection.Range.Text = composite
'Select the on word the right (myText2)
Selection.MoveRight Unit:=wdWord, Count:=Len("d) Serves As = " & rsGetPosition.Fields("Serves As").Value), Extend:=wdMove
'Format myText2
Selection.Range.Font.Underline = False
Selection.Range.Font.Bold = False
Selection.Range.Font.Size = 12
composite = ""
composite = "e) Currently Supervies = " & rsGetPosition.Fields("Currently Supervies").Value & vbCrLf
ActiveDocument.Tables(1).Cell(8, 1).Select
'Move to the right
Selection.Collapse Direction:=wdCollapseEnd
'Move back to the left
Selection.MoveLeft wdCharacter, 1
'Add the text (using the myText1 format)
Selection.Range.Text = composite
'Select the on word the right (myText2)
Selection.MoveRight Unit:=wdWord, Count:=Len("e) Currently Supervies = " & rsGetPosition.Fields("Currently Supervies").Value), Extend:=wdMove
'Format myText2
Selection.Range.Font.Underline = False
Selection.Range.Font.Bold = False
Selection.Range.Font.Size = 12
rsGetPosition.MoveNext
Wend
End If
I am printing multiple text in one cell of table of word with different formating like Bold,italic ..
Last edited: