Home All Groups Group Topic Archive Search About

still problems reading word documents...

Author
22 May 2009 10:08 AM
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

Author
22 May 2009 10:29 AM
Armin Zingler
Co wrote:
> 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
Author
22 May 2009 12:41 PM
Co
Show quote Hide quote
On 22 mei, 12:29, "Armin Zingler" <az.nos***@freenet.de> wrote:
> Co wrote:
> > 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

Armin,

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

(-:
Marco
Author
22 May 2009 3:25 PM
Cor Ligthert[MVP]
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
Author
22 May 2009 3:56 PM
Armin Zingler
Cor Ligthert[MVP] wrote:
> 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
Author
22 May 2009 5:28 PM
Co
Show quote Hide quote
On 22 mei, 17:56, "Armin Zingler" <az.nos***@freenet.de> wrote:
> Cor Ligthert[MVP] wrote:
> > 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

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