Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refer to current selection of WordPro file from VBA

Status
Not open for further replies.

gnasher

IS-IT--Management
Jan 16, 2004
11
GB
I have a VBA function which runs from an MS Access Application.

The module opens a given file, highlights the first few lines of text and then closes the file.

However, I want to store this selected text within a string variable - I have very little knowledge of lotusscript and need to know how to refer to this selected area...

[vb]
Public Function ExtractWordProDetails(Filename As Variant,

Path As Variant) As Variant

'Testing? call ExtractWordProDetails("test", "C:\")

Dim WordProApp As Object
Dim WordProDoc As Object
Dim WordProOpen As Boolean
Dim CustomerAddress As String

CustomerAddress = "Not Known"

Set WordProDoc = GetObject("", "wordpro.application")

If WordProDoc Is Nothing Then

Set WordProApp = CreateObject("wordpro.application")

Else

WordProOpen = True

End If

Call WordProDoc.OpenDocument(Filename & ".lwp", Path)

Set WordProApp = WordProDoc.Parent

Set WordProDoc = WordProApp.ActiveDocument

WordProApp.Visible = True

Dim strTest As String

With WordProDoc

WordProApp.TYPE "[shiftDown][shiftDown][shiftDown]"
.CopySelection
'*****************************************
'NEED TO ASSIGN WHATEVER IS IN THE SELECTED AREA TO
'strTest VARIABLE HERE
'*****************************************

End With

Debug.Print strTest

WordProApp.Quit
Set WordProDoc = Nothing
Set WordProApp = Nothing

End Function
[/vb]

Any help greatfully appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top