Greetings:
I have a routine that allows the User to select a gif file (using: Application.GetOpenFilename) which is the dimensioned and placed on
the 'MAIN SHEET'. After the new logo image has been selected and placed on the 'MAIN SHEET', it is copied and then pasted on 'ANOTHER
SHEET'; the following code applies:
'REMOVE PRIOR INSTANCE OF 'imgLogo' IF ONE EXISTS ON 'ANOTHER SHEET' tmpID = ActiveWorkbook.Sheets("ANOTHER SHEET").Shapes("imgLogo").ID If Not IsEmpty(tmpID) Then 'Do if prior 'imgLogo' exists ActiveWorkbook.Sheets("ANOTHER SHEET").Shapes("imgLogo").Select Selection.Delete End If 'COPY LOGO SHAPE ActiveWorkbook.Sheets("MAIN SHEET").Shapes("newLogo").Copy 'PASTE LOGO TO ANOTHER PAGE ActiveWorkbook.Sheets("ANOTHER SHEET").Range("A1").Paste 'NOTE: CELL A1 IS NOT IN A MERGED RANGE 'NAME THE PASTED SHAPE Selection.Name = "imgLogo" 'RELOCATE THE SHAPE ActiveWorkbook.Sheets("ANOTHER SHEET").Shapes(Selection.Name).Left = 3 'Place Horizontally ActiveWorkbook.Sheets("ANOTHER SHEET").Shapes(Selection.Name).Top = 30 ' Place vertically 'RETURN FOCUS TO 'MAIN SHEET' ActiveWorkbook.Sheets("MAIN SHEET").Select
The problem I am experiencing is that a few of the worksheets to which I am pasting this picture shape have merged cells, however none
located where I desire 'imgLogo' to be placed. FRequently, I get a warning dialog saying 'This operation will cause some merged cells to
unmerge' (See screen shot)
To attempt to overcome this, I have added a Range reference 'A1' (cell not in a merged range) to the Paste command in hopes that by doing
so, the pasted shape will not first be pasted in a merged range.
It is important to note that when opting to proceed (OK) after encountering the warning dialog, the logo shape does relocate as shown in
the above code ('RELOCATE THE SHAPE).
Bookmarks