PC Review


Reply
Thread Tools Rate Thread

changing a macro so it's not cell specific

 
 
jsteelfox@mail.pa.citrus.fl.us
Guest
Posts: n/a
 
      28th Jul 2008
I recorded a macro to be able to insert a picture from our network
drive and it works well. However I would like to be able to change the
picture identification (idxxxxxx) and picture (jpg) for different
accounts while still using the same spreadsheet form. Does anyone know
how to help? Below is the marco I would like to change.

Sub SubjectPhoto()
'
' SubjectPhoto Macro
' Macro recorded 10/31/2007 by
'

'
ActiveSheet.Unprotect
Range("AE7").Select
ActiveSheet.Pictures.Insert( _
"\\server1\documents\Value Adjustment Board
\id064410.jpg").Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 275.25
Selection.ShapeRange.Width = 364.5
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 215.25
Selection.ShapeRange.Width = 285#
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.IncrementLeft -72#
Selection.ShapeRange.IncrementTop -51.75
Selection.ShapeRange.IncrementLeft -3#
Range("C8").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub
 
Reply With Quote
 
 
 
 
StumpedAgain
Guest
Posts: n/a
 
      28th Jul 2008
If you put the picture ID in cell A1 you could try the following:

ActiveSheet.Pictures.Insert( _
"\\server1\documents\Value Adjustment Board
\id" & Range("A1").Value & ".jpg").Select

Is that what you're after?
--
-SA


"(E-Mail Removed)" wrote:

> I recorded a macro to be able to insert a picture from our network
> drive and it works well. However I would like to be able to change the
> picture identification (idxxxxxx) and picture (jpg) for different
> accounts while still using the same spreadsheet form. Does anyone know
> how to help? Below is the marco I would like to change.
>
> Sub SubjectPhoto()
> '
> ' SubjectPhoto Macro
> ' Macro recorded 10/31/2007 by
> '
>
> '
> ActiveSheet.Unprotect
> Range("AE7").Select
> ActiveSheet.Pictures.Insert( _
> "\\server1\documents\Value Adjustment Board
> \id064410.jpg").Select
> Selection.ShapeRange.LockAspectRatio = msoTrue
> Selection.ShapeRange.Height = 275.25
> Selection.ShapeRange.Width = 364.5
> Selection.ShapeRange.Rotation = 0#
> Selection.ShapeRange.LockAspectRatio = msoTrue
> Selection.ShapeRange.Height = 215.25
> Selection.ShapeRange.Width = 285#
> Selection.ShapeRange.Rotation = 0#
> Selection.ShapeRange.IncrementLeft -72#
> Selection.ShapeRange.IncrementTop -51.75
> Selection.ShapeRange.IncrementLeft -3#
> Range("C8").Select
> ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
> Scenarios:=True
> End Sub
>

 
Reply With Quote
 
Susan
Guest
Posts: n/a
 
      28th Jul 2008
try using something like this:

dim myPictureName as Variant

myPictureName = Application.GetOpenFilename _
(filefilter:="Picture
Files,*.jpg;*.bmp;*.tif;*.gif")

this will allow the picture to be chosen using the browser instead of
hard coding the name.......

this thread in the programming group shows how they did it:
http://groups.google.com/group/micro...a58bd036d5cd9c
hope it helps!

susan



On Jul 28, 1:20*pm, jsteel...@mail.pa.citrus.fl.us wrote:
> I recorded a macro to be able to insert a picture from our network
> drive and it works well. However I would like to be able to change the
> picture identification (idxxxxxx) and picture (jpg) for different
> accounts while still using the same spreadsheet form. Does anyone know
> how to help? Below is the marco I would like to change.
>
> Sub SubjectPhoto()
> '
> ' SubjectPhoto Macro
> ' Macro recorded 10/31/2007 by
> '
>
> '
> * * ActiveSheet.Unprotect
> * * Range("AE7").Select
> * * ActiveSheet.Pictures.Insert( _
> * * * * "\\server1\documents\Value Adjustment Board
> \id064410.jpg").Select
> * * Selection.ShapeRange.LockAspectRatio = msoTrue
> * * Selection.ShapeRange.Height = 275.25
> * * Selection.ShapeRange.Width = 364.5
> * * Selection.ShapeRange.Rotation = 0#
> * * Selection.ShapeRange.LockAspectRatio = msoTrue
> * * Selection.ShapeRange.Height = 215.25
> * * Selection.ShapeRange.Width = 285#
> * * Selection.ShapeRange.Rotation = 0#
> * * Selection.ShapeRange.IncrementLeft -72#
> * * Selection.ShapeRange.IncrementTop -51.75
> * * Selection.ShapeRange.IncrementLeft -3#
> * * Range("C8").Select
> * * ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
> Scenarios:=True
> End Sub


 
Reply With Quote
 
jsteelfox@mail.pa.citrus.fl.us
Guest
Posts: n/a
 
      29th Jul 2008
On Jul 28, 1:40*pm, StumpedAgain
<StumpedAg...@discussions.microsoft.com> wrote:
> If you put the picture ID in cell A1 you could try the following:
>
> * * ActiveSheet.Pictures.Insert( _
> * * * * "\\server1\documents\Value Adjustment Board
> \id" & Range("A1").Value & ".jpg").Select
>
> Is that what you're after?
> --
> -SA
>
>
>
> "jsteel...@mail.pa.citrus.fl.us" wrote:
> > I recorded a macro to be able to insert a picture from our network
> > drive and it works well. However I would like to be able to change the
> > picture identification (idxxxxxx) and picture (jpg) for different
> > accounts while still using the same spreadsheet form. Does anyone know
> > how to help? Below is the marco I would like to change.

>
> > Sub SubjectPhoto()
> > '
> > ' SubjectPhoto Macro
> > ' Macro recorded 10/31/2007 by
> > '

>
> > '
> > * * ActiveSheet.Unprotect
> > * * Range("AE7").Select
> > * * ActiveSheet.Pictures.Insert( _
> > * * * * "\\server1\documents\Value Adjustment Board
> > \id064410.jpg").Select
> > * * Selection.ShapeRange.LockAspectRatio = msoTrue
> > * * Selection.ShapeRange.Height = 275.25
> > * * Selection.ShapeRange.Width = 364.5
> > * * Selection.ShapeRange.Rotation = 0#
> > * * Selection.ShapeRange.LockAspectRatio = msoTrue
> > * * Selection.ShapeRange.Height = 215.25
> > * * Selection.ShapeRange.Width = 285#
> > * * Selection.ShapeRange.Rotation = 0#
> > * * Selection.ShapeRange.IncrementLeft -72#
> > * * Selection.ShapeRange.IncrementTop -51.75
> > * * Selection.ShapeRange.IncrementLeft -3#
> > * * Range("C8").Select
> > * * ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
> > Scenarios:=True
> > End Sub- Hide quoted text -

>
> - Show quoted text -


This is exactly what I was trying to do. Thank you very much.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run an event upon changing the value of a specific cell? Wael Fathy Microsoft Excel Worksheet Functions 1 23rd Feb 2010 02:04 PM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Microsoft Excel Misc 0 29th Jun 2009 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Microsoft Excel Misc 0 26th Jun 2009 06:01 PM
Changing the Color of Specific Characters using a Macro Frustrated IT Tech Microsoft Excel Worksheet Functions 6 26th Apr 2008 05:19 PM
Changing one specific character in cell Mark Christensen Microsoft Excel Discussion 9 12th Sep 2007 01:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:01 PM.