LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 12
Default VBA Script to insert image

Hi there,

I am struggling on getting a VBA script to work correctly for a spreadsheet and I am seeking guidance. I am using Excell 2007 Professional and what I am trying to do is create a profile pages for an event at work.

What i'm trying to do is have the profile page set up, and where the picture will go have a box the user can click, once they click the box it will load a window for them to browse their computers directory to find the image, choose the image and say "ok" and it will insert and resize the image to the specified cell size. Once the image is inserted the box would either be covered up or disapear.

Can this be achieved? All I have been able to figure out is the following which will not resize or set destination cell and only allows JPEG's.

Please help! I am new to trying to code VBA projects.

Private Sub CommandButton1_Click()
Dim JPeg()
Dim flname As Variant
flname = Application.GetOpenFilename
If flname < False Then
If Right(flname, 3) = "jpg" Then
ActiveSheet.Pictures.Insert (flname)
Else
MsgBox "That is not a jpeg file"
End If
End If
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to insert Row Jeremy Excel Discussion (Misc queries) 2 April 19th 10 02:39 PM
Need VBA script to auto-insert value upon row insert Phil Excel Worksheet Functions 4 May 6th 08 02:41 PM
Insert image, get name of image Rick S. Excel Programming 3 April 15th 08 07:05 PM
Insert a key function in VBA script Bowes813 Excel Programming 3 May 26th 05 11:27 PM
insert excel vb script bt707[_6_] Excel Programming 1 October 18th 03 03:43 PM


All times are GMT +1. The time now is 08:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"