Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

Passing a variable in VB to a function in Vb Environment of Word

Hi,

I am having a problem passing  variables from VB to a function in Word. I want the two variables I am passing to populate a table in Word.

This is the code in VB....

Private Sub OpenAbsDoc()
Dim iResponse As Integer
Dim wd As Word.Application

Set wd = New Word.Application

wd.Documents.Open("C:\Reports\Absent20days.doc")

'document_open is the function in VB Editor of Word
 'I am trying to send the two variables to
wd.ActiveDocument.GoTo ([Document_Open (stuID(index)), (stunames(index))])

wd.Visible = True

'Release the word object
Set wd = Nothing

End Sub

-----------------------------------------------

The following code is in the Vb Editor of Word 2000...

Public Sub PlaceInDocument(intTable As Integer, intRow As Integer, _
intCol As Integer, stValue As Variant)

    Set myRange = ActiveDocument.Tables(intTable).Cell(intRow, intCol).Range
        myRange.Text = stValue

End Sub


Private Sub Document_Open(name As String, ID As String)

Dim stname, stID As String
stname = name
stID = ID

'populate the second cell of the first row &
'the second cell of the second row
PlaceInDocument 1, 1, 2, stname
PlaceInDocument 1, 2, 2, stID


End Sub

-----------------------------------------------------

I realise that
wd.ActiveDocument.GoTo
is probably not correct but I was hoping someone could help me out on the correct approach here.

Thanks
0
alan_j
Asked:
alan_j
1 Solution
 
CleanupPingCommented:
alan_j:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now