Not sure if this would require a new thread, but i am trying to parlay this into inserting the found image into the header of my document. I am getting Run-time error '5152' This is not a valid filename on the bolded line below:
Sub Logocheck()Dim oLogo As InlineShape Dim ImgName As String Dim ImgPath As String Dim oSec As Section Dim oHeader As HeaderFooter ImgPath = ThisDocument.Path ImgName = Dir$(ImgPath & "\*logo*") If ImgName = vbNullString Then MsgBox "Please note logo image was not found. You will need to manually insert the company logo into your final review." End If For Each oSec In ActiveDocument.Sections Set oHeader = oSec.Headers(wdHeaderFooterPrimary) With oHeader.Range .ParagraphFormat.Alignment = wdAlignParagraphRight Set oLogo = .InlineShapes.AddPicture(ImgName) End With With oLogo .LockAspectRatio = True .Height = 50 End With Next oSec End Sub




Reply With Quote