Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2006

Tip: Looking for answers? Try searching our database.

Ye olde Font.Position problem with non-integers...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
david@dhx.de - 12 Dec 2006 14:27 GMT
Hello everyone,

After much research, I've finally figured out why the parameters I was
giving my script for positioning InlineShapes according to certain
values was slightly off: .Position only takes integers! After digging
some more, I came across someone's brilliant idea to use the old
WordBasic command syntax which supposedly doesn't have this problem.
But I can't get the commands to work :-(

[snip some code]

Dim Form As InlineShape
Dim iVar As Variant
Dim Feld1() As String
Open ActiveDocument.Path + "\" & sCount & ".txt" For Input As #1
Text = Input(LOF(1), #1)
Feld1 = Split(Text, vbCrLf)
Close #1
Anz = ActiveDocument.InlineShapes.Count
 For i = 1 To Anz
 iVar = Val(Feld1(i - 1))
   Set Form = ActiveDocument.InlineShapes(i)
  ' Form.Range.Font.Position = iVar
    WordBasic.FormatFont Position:=iVar
 Next i

Is there a different sort of command syntax involved? Must I "select"
the InlineShape first? Or am I barking up the wrong tree?
Thanks in advance
David
Helmut Weber - 12 Dec 2006 18:28 GMT
Hi  David,

and what is it, that goes wrong?

First, split returns a zero based array.

Second, when passing a single to .Font.Position
having read the value form a text file
with possibly regional standards of spelling,
2,5 vs 2.5, as "Feld1" looks very much much like german to me,
you may encounter more problems.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

david@dhx.de - 12 Dec 2006 19:38 GMT
Hi Helmut,

you wrote:
> and what is it, that goes wrong?

Well... this works as expected:
     Form.Range.Font.Position = iVar

This, on the other hand, does absolutely nothing, not even an error
message:
     WordBasic.FormatFont Position:=iVar

And so I would appreciate if soemone could tell me the necessary
parameters , if any.

> First, split returns a zero based array.

I know... but the text file is just a simple list of numerical values
which give the desired position for the corresponding Inlineshapes,
e.g.
-9.5
-5.0
-7.0
and so on. It seemed simpler than ReDim :-)

> Second, when passing a single to .Font.Position
> having read the value form a text file
> with possibly regional standards of spelling,
> 2,5 vs 2.5, as "Feld1" looks very much much like german to me,
> you may encounter more problems.

All the text files are formatted the same way, so I'm not really
worried about exceptions; but I am worried that I can't assign precise
values to the different Inlineshapes. Always rounding pt-values is a
bit of a bother...

I know this is a somewhat esoteric problem, but maybe there's a
solution out there... one that I can understand :-)

All the best
David
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.