![]() Thanks GrahamSkan, your of great help to me on this project that I am trying to finish up soon. Thank You! Sub RemoveLogo() ActiveDocument.Sections(1).Range.Select = wdSeekCurrentPageHeader Dim shapes_to_delete As New Collection For i = 1 To If InStr((i).Name, "Picture 4") > 0 Then shapes_to_delete.Add ((i).Name) End If Next i For i = 1 To If InStr((i).Name, "Picture 2") > 0 Then shapes_to_delete.Add ((i).Name) End If Next i For Each s In shapes_to_delete (s).Select Selection.Delete Next s = wdSeekMainDocument End Sub So my RemoveLogo subroutine would work below, if I had static names every time a picture gets inserted.Īny help would be greatly appreciated, please let me know if you need anymore information. If there is a way to define the name of the picture once it gets inserted into the document? Instead of just having MS Word name the picture as "picture x" every time it gets inserted. My template has a different first page header, I also have other text in my headers that should not get removed, so I can't just remove everything from the header. So I need to come up with a good macro that won't care what the picture names are, but will just get rid of them from the headers. If you re-insert again, they get "Picture 21" and "Picture 18", so I guess these are names that Word automatically assigns these pictures in VBA when they get inserted. Once I remove the pictures and re-insert using my macro the pictures get inserted as "Picture 12" and "Picture 9". So for example, the initial picture names in the template are literally "Picture 4", which is in the first page of the template and "Picture 2" which is in the second page header of the template. I just noticed that every time I re-insert the picture into the header (using my insert macro) then names of the pictures change. However, in the subroutine that removes the picture I have explicitly defined the picture names that need to be removed from the header of the document. I have a few macros in that template, one removes the picture from the header and another re-inserts the picture. ![]() You may close the Styles and Formatting window now, if desired.I currently have a template in MS Word, which has a picture in the header of the document.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |