Live-Forum - Die aktuellen Beiträge
Datum
Titel
24.04.2024 19:29:30
24.04.2024 18:49:56
Anzeige
Archiv - Navigation
1428to1432
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

WordVBA, Insert and Pos. Shape with selection.find

WordVBA, Insert and Pos. Shape with selection.find
15.06.2015 11:13:43
Stefan
Servus,
folgendes Problem:
der folgende Code sollte ein Bild einfügen, dann formatieren,
danach ausschneiden und an der Position wo der Text mit selection.find
gefunden wird einfügen diese Position auslesen und dann
anhand der ausgelesenen Werte "richtig" Positionieren,
leider funktioniert dies nur auf der 1. Seite des Dokuments.
Wenn sich das Pic nicht auf Seite 1 befindet lest er falsche positionswerte aus.
Ich hoffe irgenjemand kann mir bitte weiterhelfen.
Public Sub test()
Dim strPathPic As String
Dim strPic As String
Dim strBMP As String
Dim Shp As Shape
Dim dblLeft As Double
Dim dblTop As Double
Dim blnYesNo As Boolean
strPathPic = "C:\FHK95\Bilder\"
strBMP = ".bmp"
If MsgBox("Angebot mit Bildern Ja, oder nein?", vbYesNo) _
= vbYes Then blnYesNo = True Else blnYesNo = False
For iCounter = 1 To 15
If iCounter = 1 Then strPic = "Shape_Streifenfundament"
strPAR = strPathPic & strPic & strBMP
Do
If blnYesNo = True Then
Set Shp = ActiveDocument.Shapes.AddPicture(FileName:= _
strPAR, LinkToFile:=False, savewithdocument:=True)
With Shp
.ConvertToInlineShape
.Width = 125
.Height = 50
.Select
End With
Selection.Cut
End If
With Word.Selection.Find
.ClearFormatting
.Text = strPic
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = True
If blnYesNo = False Then
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
ElseIf blnYesNo = True Then
If .Execute = True Then
Selection.Paste
dblLeft = Shp.Left
dblTop = Shp.Top
'                            Shp.Delete
'                            Selection.Paste
Shp.WrapFormat.Type = wdWrapThrough
Shp.Left = dblLeft + 365
Shp.Top = dblTop + 45
Else: Exit Do
End If
End If
End With
Loop
Next iCounter
End Sub

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: WordVBA, Insert and Pos. Shape with selection.find
15.06.2015 11:16:13
JoWE
Hallo Stefan,
da bietet sich als Anlaufstelle so'n Excel-Forum natürlich spontan an.... :-)
Gruß
Jochen

AW: WordVBA, Insert and Pos. Shape with selection.find
15.06.2015 11:26:55
Stefan
Servus,
dadurch dass ich mein Word aus Excel heraus starte und der Code auch im Excel steht und beides ja "relativ" ähnlich ist bietet sich ein Excel Forum welches kompetent scheint an. Ja

AW: ah ja,..
15.06.2015 11:35:21
JoWE
und nochmal Hallo,
nun, das war weder in der Betreffzeile noch in Deinem Beitrag erkennbar.
Egal, ich stelle Deine Frage für alle nochmal offen.
Gruß
Jochen

310 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige