Toon posts:

[vb][word] plaatjes m.b.v. VB afmetingen meegeven

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hallo,
ik heb een opdracht in VB gemaakt om in de koptekst een tekstvak te maken met in dat tekstvak een figuur op de volgende manier:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
...
    Selection.HeaderFooter.Shapes.AddTextbox(msoTextOrientationHorizontal, _
      33.35, 48#, 60#, 693#).Select
    Selection.ShapeRange.TextFrame.TextRange.Select
    Selection.Collapse
    Selection.InlineShapes.AddPicture FileName:= _
      "fax.jpg", _
      LinkToFile:=False, SaveWithDocument:=True
    Selection.ShapeRange.Select
    Selection.ShapeRange.IncrementTop -10#
    Selection.ShapeRange.Fill.Visible = msoFalse
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Height = 689.05
    Selection.ShapeRange.Width = 55.45
    Selection.ShapeRange.Line.Weight = 0.75
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoFalse
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.TextFrame.MarginLeft = 0#
    Selection.ShapeRange.TextFrame.MarginRight = 0#
    Selection.ShapeRange.TextFrame.MarginTop = 0#
    Selection.ShapeRange.TextFrame.MarginBottom = 0#
...

Dit werkt alleen is plaatje nu verkeerd geschaald. Deze moet ook deze waarden meekrijgen:
Height = 689.05
Width = 55.45
dit heb ik geprobeerd door dit toe te voegen maar dat werkte niet:
code:
1
2
3
4
...
    Selection.InlineShapes(1).Height = 689.05
    Selection.InlineShapes(1).Width = 55.45
...

Ik weet niet hoe ik dit moet oplossen.

  • baskabas
  • Registratie: December 2000
  • Laatst online: 05-04 12:26
TIP: Probeer de resize actie eens handmatig en neem een macro op... dan kun je tussen die bagger de juiste code wel vinden denk ik. :)

Verwijderd

Topicstarter
dat heb ik al geprobeerd maar ik krijg met het maken van macro niet de mogelijkheid om het plaatje te selecteren. Alleen als ik hem selecteer en dan een macro opneem krijg ik deze code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
    Selection.InlineShapes(1).Fill.Visible = msoFalse
    Selection.InlineShapes(1).Fill.Transparency = 0#
    Selection.InlineShapes(1).Line.Weight = 0.75
    Selection.InlineShapes(1).Line.Transparency = 0#
    Selection.InlineShapes(1).Line.Visible = msoFalse
    Selection.InlineShapes(1).LockAspectRatio = msoTrue
    Selection.InlineShapes(1).Height = 666#
    Selection.InlineShapes(1).Width = 53.29
    Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
    Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
    Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
    Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
    Selection.InlineShapes(1).PictureFormat.CropRight = 0#
    Selection.InlineShapes(1).PictureFormat.CropTop = 0#
    Selection.InlineShapes(1).PictureFormat.CropBottom = 0#

waarvan dit de code is die ik nodig heben niet werkt:
code:
1
2
    Selection.InlineShapes(1).Height = 666#
    Selection.InlineShapes(1).Width = 53.29

  • baskabas
  • Registratie: December 2000
  • Laatst online: 05-04 12:26
Weet je zeker dat het plaatje op dat moment geselecteerd is?

Weet je zeker dat het niet werkt? Probeer bijvoorbeeld eens een waarde in de Height en Width te zetten en lees daarna de waarde weer uit... als deze gewoon gewijzigd is, dan heb je gewoon de verkeerde properties te pakken...

Heb je al geprobeerd wat met de Crop properties te spelen van de Picture Format?

Verwijderd

Topicstarter
ik heb het op een andere manier opgelost:
code:
1
2
3
4
5
6
7
8
9
    Selection.ShapeRange.TextFrame.TextRange.Select
    Selection.MoveDown Unit:=wdLine, Count:=2, Extend:=wdExtend
    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
    Selection.MoveUp Unit:=wdLine, Count:=2, Extend:=wdExtend
    Selection.InlineShapes(1).Height = 689.05
    Selection.InlineShapes(1).Width = 55.45

gewoon een beetje heen en weer selecteren.