Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Simple macro to insert user selected picture into Excel 2003

Hi,

I currently have a protected spreadsheet that I want to add pictures too. I
have been able to figure out a certain amount of the programming but I'm not
aware of how to make it open a browser window to pick the file rather than
insert a specific file. Let me emphasize, I want to keep this simple. Below
is what I have so far. What do I replace the specific file pick with to
allow for any picture file to be picked?

ActiveSheet.Unprotect
Range("A1:B2").Select

' This is the part I need to change.
ActiveSheet.Pictures.Insert( _
"C:\Documents and
Settings\casem02.AMER\Desktop\32604galloapproval.j pg").Select

Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 712#
Selection.ShapeRange.Width = 892#
Selection.ShapeRange.Rotation = 0#
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowInsertingRows:=True
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Simple macro to insert user selected picture into Excel 2003

Use a dialog box:

Sub dural()
myPictureName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")
ActiveSheet.Pictures.Insert(myPictureName).Select

End Sub

--
Gary''s Student - gsnu200832


"Melody" wrote:

Hi,

I currently have a protected spreadsheet that I want to add pictures too. I
have been able to figure out a certain amount of the programming but I'm not
aware of how to make it open a browser window to pick the file rather than
insert a specific file. Let me emphasize, I want to keep this simple. Below
is what I have so far. What do I replace the specific file pick with to
allow for any picture file to be picked?

ActiveSheet.Unprotect
Range("A1:B2").Select

' This is the part I need to change.
ActiveSheet.Pictures.Insert( _
"C:\Documents and
Settings\casem02.AMER\Desktop\32604galloapproval.j pg").Select

Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 712#
Selection.ShapeRange.Width = 892#
Selection.ShapeRange.Rotation = 0#
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowInsertingRows:=True
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Simple macro to insert user selected picture into Excel 2003

Worked great. Nice and Simple. Thanks.

"Gary''s Student" wrote:

Use a dialog box:

Sub dural()
myPictureName = Application.GetOpenFilename _
(filefilter:="Picture Files,*.jpg;*.bmp;*.tif;*.gif")
ActiveSheet.Pictures.Insert(myPictureName).Select

End Sub

--
Gary''s Student - gsnu200832


"Melody" wrote:

Hi,

I currently have a protected spreadsheet that I want to add pictures too. I
have been able to figure out a certain amount of the programming but I'm not
aware of how to make it open a browser window to pick the file rather than
insert a specific file. Let me emphasize, I want to keep this simple. Below
is what I have so far. What do I replace the specific file pick with to
allow for any picture file to be picked?

ActiveSheet.Unprotect
Range("A1:B2").Select

' This is the part I need to change.
ActiveSheet.Pictures.Insert( _
"C:\Documents and
Settings\casem02.AMER\Desktop\32604galloapproval.j pg").Select

Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 712#
Selection.ShapeRange.Width = 892#
Selection.ShapeRange.Rotation = 0#
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowInsertingRows:=True
End Sub

Reply
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
How to create a simple insert pic macro in Excel 2003 Melody Excel Programming 1 February 11th 09 06:01 PM
Excel 2003, insert picture, save as HTM, FTP to website, no pic? gp smith Excel Discussion (Misc queries) 0 March 6th 07 03:19 PM
Excel 2003 Insert Picture changes JPG to PNG format WildBill Excel Discussion (Misc queries) 1 December 1st 05 12:41 AM
Excel 2003 - insert picture - Not Responding trinity Setting up and Configuration of Excel 4 October 17th 05 12:46 PM
Simple Insert Picture question Paul Excel Programming 1 September 15th 03 08:37 PM


All times are GMT +1. The time now is 05:24 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"