i have workbook 5 sheet. each sheet has print area defined , want insert word art @ right top corner of print area. using below code it. problem shape appears anywhere in sheet , not right top corner of print area. suggestion ?
sub test() dim col string, row long, rng range dim sht worksheet, str_val string dim shp shape each sht in thisworkbook.sheets str_val = sht.name & vbnewline & "ym" & vbnewline & date sht.activate if activesheet.pagesetup.printarea <> vbnullstring col = split(activesheet.pagesetup.printarea, "$")(3) row = range(activesheet.pagesetup.printarea).cells(1).row str_val = sht.name & vbnewline & "ym" & vbnewline & date set rng = cells(row, col) set shp = activesheet.shapes.addtexteffect(msotexteffect28, str_val, "+mn-lt", 20, msotrue, msofalse, rng.left, rng.top) end if next end sub
thanks looking it.
this worked me:
sub tester() dim shp shape, rngtr range, pa range dim t, l set pa = activesheet.range(activesheet.pagesetup.printarea) set rngtr = pa.rows(1).cells(pa.columns.count) set shp = activesheet.shapes.addtexteffect(msotexteffect28, _ "hello world", "+mn-lt", 20, msotrue, _ msofalse, rngtr.left, rngtr.top) 'adjust shape width shp.left = shp.left - (shp.width - rngtr.width) end sub
Comments
Post a Comment