?
Solved

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

Posted on 2003-02-25
3
Medium Priority
?
200 Views
Last Modified: 2010-04-17
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
Comment
Question by:alan_j
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
bhagyesht earned 225 total points
ID: 8023021
0
 

Expert Comment

by:CleanupPing
ID: 9447502
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question