still problems reading word documents...

  • Thread starter Thread starter Co
  • Start date Start date
C

Co

Hi All,

I tried a new code to read the first page of a word document and save
the content to a richttextbox.
The code I created just reads the first character of the first page
instead of the first page:

Function ReadWordDocument(ByVal sPathName As String) As String

Dim wdToepassing As New Word.Application()
Dim wdDoc As Word.Document
Dim oBuiltInProps As Object
Dim strValue As String
Dim oRange As Word.Range
Dim PgDepart As Long

Try
wdDoc = wdToepassing.Documents.Open(sPathName)

'Get the Built-in Document Properties collection.
oBuiltInProps = wdDoc.BuiltInDocumentProperties
'Get the value of the Author property
strValue = oBuiltInProps.Item("Author").Value

PgDepart = wdToepassing.Selection.Range.Start

'Move the insertion pointer to the bottom of the first
page
oRange = wdDoc.Range(Start:=PgDepart, End:=PgDepart + 1)
oRange.Copy()

ReadWordDocument = _
CStr(System.Windows.Forms.Clipboard.GetDataObject.GetData
(DataFormats.Text))

Catch oException As Exception
MessageBox.Show(oException.Message)
ReadWordDocument = ""

Finally
oRange = Nothing
wdDoc = Nothing
wdToepassing.ActiveWindow.Close()
wdToepassing = Nothing
End Try

End Function

regards
Marco
The Netherlands
 
Co said:
Hi All,

I tried a new code to read the first page of a word document and save
the content to a richttextbox.
The code I created just reads the first character of the first page
instead of the first page:

I hope it is not considered inpolite again if I ask you to turn to the Word
VBA group. ("turn to" = "sich wenden an", isn't it?) Because I think you
don't have VB.Net language related problem.


Armin
 
Co said:
Hi All,

I tried a new code to read the first page of a word document and save
the content to a richttextbox.
The code I created just reads the first character of the first page
instead of the first page:

I hope it is not considered inpolite again if I ask you to turn to the Word
VBA group. ("turn to" = "sich wenden an", isn't it?) Because I think you
don't have VB.Net language related problem.


Armin
 
I hope it is not considered inpolite again if I ask you to turn to the Word
VBA group. ("turn to" = "sich wenden an", isn't it?) Because I think you
don't have VB.Net language related problem.

Armin

Armin,

you are right.
I will do that.
But for your information I'm not German, I'm Dutch.

(-:
Marco
 
I hope it is not considered inpolite again if I ask you to turn to the Word
VBA group. ("turn to" = "sich wenden an", isn't it?) Because I think you
don't have VB.Net language related problem.

Armin

Armin,

you are right.
I will do that.
But for your information I'm not German, I'm Dutch.

(-:
Marco
 
ROFL


you are right.
I will do that.
But for your information I'm not German, I'm Dutch.

Marco,

Where do you think Armin is from?

He probably expects that a little bit Dutch person at least could understand
a little bit the German Language

He asks you if you did understand "Turn To" in formal not much anymore used
Dutch "Zich te wenden tot" in German "sich wenden an"

In past Armin wrote often "Please go....." translated in German it is
polite, for Dutch and people from England, it can be understand in a not
meant context .

:-)

Cor
 
ROFL


you are right.
I will do that.
But for your information I'm not German, I'm Dutch.

Marco,

Where do you think Armin is from?

He probably expects that a little bit Dutch person at least could understand
a little bit the German Language

He asks you if you did understand "Turn To" in formal not much anymore used
Dutch "Zich te wenden tot" in German "sich wenden an"

In past Armin wrote often "Please go....." translated in German it is
polite, for Dutch and people from England, it can be understand in a not
meant context .

:-)

Cor
 
Cor said:
ROFL


you are right.
I will do that.
But for your information I'm not German, I'm Dutch.

Marco,

Where do you think Armin is from?

He probably expects that a little bit Dutch person at least could
understand a little bit the German Language

Was not meant to be a question (or expectation) to MarCo himeself. I was
more thinking out loud (or for those that know what I meant).
He asks you if you did understand "Turn To" in formal not much
anymore used Dutch "Zich te wenden tot" in German "sich wenden an"

In past Armin wrote often "Please go....."

I'm almost sure I never wrote this (though, admittedly I don't remember
every single of all my posts by heart). But I once wrote "please turn to"
which someone considered "instructive" and inpolite - therefore I never
dared to write it again.

Anyway, I've just learned my first Dutch words. :)

....no, wait, I already know some: Tenminste houdbaar tot

;-)



Armin
 
Cor said:
ROFL


you are right.
I will do that.
But for your information I'm not German, I'm Dutch.

Marco,

Where do you think Armin is from?

He probably expects that a little bit Dutch person at least could
understand a little bit the German Language

Was not meant to be a question (or expectation) to MarCo himeself. I was
more thinking out loud (or for those that know what I meant).
He asks you if you did understand "Turn To" in formal not much
anymore used Dutch "Zich te wenden tot" in German "sich wenden an"

In past Armin wrote often "Please go....."

I'm almost sure I never wrote this (though, admittedly I don't remember
every single of all my posts by heart). But I once wrote "please turn to"
which someone considered "instructive" and inpolite - therefore I never
dared to write it again.

Anyway, I've just learned my first Dutch words. :)

....no, wait, I already know some: Tenminste houdbaar tot

;-)



Armin
 
Was not meant to be a question (or expectation) to MarCo himeself. I was
more thinking out loud (or for those that know what I meant).



I'm almost sure I never wrote this (though, admittedly I don't remember
every single of all my posts by heart). But I once wrote "please turn to"
which someone considered "instructive" and inpolite - therefore I never
dared to write it again.

Anyway, I've just learned my first Dutch words. :)

...no, wait, I already know some: Tenminste houdbaar tot

;-)

Armin

Armin is from Germany.
I can see that.
You know there's also a lot of guys with German names living
in the States so you never know...

Also vielen dank fuer deine hilfe.
Auf wieder sehen.

Marco
 
Was not meant to be a question (or expectation) to MarCo himeself. I was
more thinking out loud (or for those that know what I meant).



I'm almost sure I never wrote this (though, admittedly I don't remember
every single of all my posts by heart). But I once wrote "please turn to"
which someone considered "instructive" and inpolite - therefore I never
dared to write it again.

Anyway, I've just learned my first Dutch words. :)

...no, wait, I already know some: Tenminste houdbaar tot

;-)

Armin

Armin is from Germany.
I can see that.
You know there's also a lot of guys with German names living
in the States so you never know...

Also vielen dank fuer deine hilfe.
Auf wieder sehen.

Marco
 
Back
Top