vba - Insert photo from Form (Office 2007) -


after code

  sheets("sheet1")         activesheet.unprotect         range("q3:s5").select         myrange = selection.address          piclocation = userform1.txtimage          if piclocation <> "false"             activesheet.pictures.insert(piclocation).select         else             exit sub         end if          selection.shaperange             .lockaspectratio = msotrue             if .width > .height                 .width = range(myrange).width                 if .height > range(myrange).height .height = range(myrange).height             else                 .height = range(myrange).height                 if .width > range(myrange).width .width = range(myrange).width             end if         end          selection             .placement = xlmoveandsize             .printobject = true         end  end 

`

my image isn't in merged cell want ("q3:s5").

but in office 2010 code fine. unfortunately, need run in office 2007.

imageissue

sorry external link, don't have reputation upload image.

also, want image in "middle alignment".

thanks!

see if version of code works. change file name how want it.

sub button1_click()     set myrng = range("q3:s5")     set mypict = myrng.parent.pictures.insert("c:\users\dave\downloads\9-29-2015 4-21-06 am.jpg")     mypict.top = myrng.top     mypict.width = myrng.width     mypict.height = myrng.height     mypict.left = myrng.left     mypict.placement = xlmoveandsize end sub 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -