Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Zoom in on selected picture

Hi all,
I am once again coming to the point where I've tried, and searched the forum
for what I think I need, but with no success....
I need a code ( as below, with a difference), that will zoom to 75% when a
(any) picturelink is selected(clicked on).
The code below works, but I have a "roadmap" of a vehicle, with leader-lines
that have a pictureLink at the end of each (50 in all) that capture data from
a hidden sheet.
At this moment I have a code for each picture.
Can the code be written so that I have one, that will zoom in on any
pictureLink selected, instead of naming a specific picture?
Instead of ("Picture 9").Select
("Selected.Shapes") or something.....


Sub SC0x09()
ActiveSheet.Shapes("Picture 9").Select
ActiveWindow.Zoom = 75
End Sub

I have 50 of these working codes right now, but would like to keep the
amount of macros down, since I have 3 more of these spreadsheets to do for
the same vehicle.
Any help is greatly appreciated
I must say, working with excel for 10 years, without knowing anything about
macros (did not even know what one was), I've improved my overall skills
since I found this site last summer. This made my spreadsheets easier to use
for the end user thanks to the great people and information on this site!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Zoom in on selected picture

Sub Picture_Click()
set shp = Activesheet.Shapes(application.Caller)
shp.Select
ActiveWindow.Zoom = 75
End Sub

You can assign this one macro to all your pictures

--
Regards,
Tom Ogilvy





"ufo_pilot" wrote in message
...
Hi all,
I am once again coming to the point where I've tried, and searched the

forum
for what I think I need, but with no success....
I need a code ( as below, with a difference), that will zoom to 75% when a
(any) picturelink is selected(clicked on).
The code below works, but I have a "roadmap" of a vehicle, with

leader-lines
that have a pictureLink at the end of each (50 in all) that capture data

from
a hidden sheet.
At this moment I have a code for each picture.
Can the code be written so that I have one, that will zoom in on any
pictureLink selected, instead of naming a specific picture?
Instead of ("Picture 9").Select
("Selected.Shapes") or something.....


Sub SC0x09()
ActiveSheet.Shapes("Picture 9").Select
ActiveWindow.Zoom = 75
End Sub

I have 50 of these working codes right now, but would like to keep the
amount of macros down, since I have 3 more of these spreadsheets to do for
the same vehicle.
Any help is greatly appreciated
I must say, working with excel for 10 years, without knowing anything

about
macros (did not even know what one was), I've improved my overall skills
since I found this site last summer. This made my spreadsheets easier to

use
for the end user thanks to the great people and information on this site!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 175
Default Zoom in on selected picture

I discoverd macros and VBA about like you did... One of the first "cryptic"
commands I found was "Application.Caller". And it was a mystery how this
worked for about 6 months, until I realized what it was really doing. This
will allow you to get the name of the shape (a picture is a kind of shape)
into a string variable. This works for almost any kind of object that you
can insert onto a worksheet.

When you insert a pic... it will get a name like "Picture 1" you can change
this to be more descriptive by using the name-box (its the box on the formula
bar that has the cell name or assigned name... and when you select a shape,
the shape's name shows there. You can change it (but be careful, duplicate
names are allowed) Then you have to get into itterating through the shapes
collection.

Each shape can be assigned to run a macro (instead of the default sub
Picture1_Click) I dont think this works in excel97 however. you need 2000
or higher. Right-click on the shape and one option will be to assign macro.

You can test for an error by using:

If TypeName(Application.Caller) = "Error" Then"
'This will be true when you run the macro with out using the shape-click
else
'Assign the name of the clicked-on shape to a string var.
shapename = Application.Caller
end if

HTH
--
Regards,
John


"ufo_pilot" wrote:

Hi all,
I am once again coming to the point where I've tried, and searched the forum
for what I think I need, but with no success....
I need a code ( as below, with a difference), that will zoom to 75% when a
(any) picturelink is selected(clicked on).
The code below works, but I have a "roadmap" of a vehicle, with leader-lines
that have a pictureLink at the end of each (50 in all) that capture data from
a hidden sheet.
At this moment I have a code for each picture.
Can the code be written so that I have one, that will zoom in on any
pictureLink selected, instead of naming a specific picture?
Instead of ("Picture 9").Select
("Selected.Shapes") or something.....


Sub SC0x09()
ActiveSheet.Shapes("Picture 9").Select
ActiveWindow.Zoom = 75
End Sub

I have 50 of these working codes right now, but would like to keep the
amount of macros down, since I have 3 more of these spreadsheets to do for
the same vehicle.
Any help is greatly appreciated
I must say, working with excel for 10 years, without knowing anything about
macros (did not even know what one was), I've improved my overall skills
since I found this site last summer. This made my spreadsheets easier to use
for the end user thanks to the great people and information on this site!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Zoom in on selected picture

Thank You both, John and Tom
Tom for your quick and easy way ( copied and pasted sub)
and John for explaining it in more detail. Which I copied and saved to to my
personal help files.
This will revolutionize my heavily macro-laden spreadsheets.

"Tom Ogilvy" wrote:

Sub Picture_Click()
set shp = Activesheet.Shapes(application.Caller)
shp.Select
ActiveWindow.Zoom = 75
End Sub

You can assign this one macro to all your pictures

--
Regards,
Tom Ogilvy





"ufo_pilot" wrote in message
...
Hi all,
I am once again coming to the point where I've tried, and searched the

forum
for what I think I need, but with no success....
I need a code ( as below, with a difference), that will zoom to 75% when a
(any) picturelink is selected(clicked on).
The code below works, but I have a "roadmap" of a vehicle, with

leader-lines
that have a pictureLink at the end of each (50 in all) that capture data

from
a hidden sheet.
At this moment I have a code for each picture.
Can the code be written so that I have one, that will zoom in on any
pictureLink selected, instead of naming a specific picture?
Instead of ("Picture 9").Select
("Selected.Shapes") or something.....


Sub SC0x09()
ActiveSheet.Shapes("Picture 9").Select
ActiveWindow.Zoom = 75
End Sub

I have 50 of these working codes right now, but would like to keep the
amount of macros down, since I have 3 more of these spreadsheets to do for
the same vehicle.
Any help is greatly appreciated
I must say, working with excel for 10 years, without knowing anything

about
macros (did not even know what one was), I've improved my overall skills
since I found this site last summer. This made my spreadsheets easier to

use
for the end user thanks to the great people and information on this site!




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Zoom in on selected picture

xl5 to xl97 should work fine.

--
Regards,
Tom Ogilvy

"John Keith" wrote in message
...
I discoverd macros and VBA about like you did... One of the first

"cryptic"
commands I found was "Application.Caller". And it was a mystery how this
worked for about 6 months, until I realized what it was really doing.

This
will allow you to get the name of the shape (a picture is a kind of shape)
into a string variable. This works for almost any kind of object that you
can insert onto a worksheet.

When you insert a pic... it will get a name like "Picture 1" you can

change
this to be more descriptive by using the name-box (its the box on the

formula
bar that has the cell name or assigned name... and when you select a

shape,
the shape's name shows there. You can change it (but be careful,

duplicate
names are allowed) Then you have to get into itterating through the

shapes
collection.

Each shape can be assigned to run a macro (instead of the default sub
Picture1_Click) I dont think this works in excel97 however. you need

2000
or higher. Right-click on the shape and one option will be to assign

macro.

You can test for an error by using:

If TypeName(Application.Caller) = "Error" Then"
'This will be true when you run the macro with out using the

shape-click
else
'Assign the name of the clicked-on shape to a string var.
shapename = Application.Caller
end if

HTH
--
Regards,
John


"ufo_pilot" wrote:

Hi all,
I am once again coming to the point where I've tried, and searched the

forum
for what I think I need, but with no success....
I need a code ( as below, with a difference), that will zoom to 75% when

a
(any) picturelink is selected(clicked on).
The code below works, but I have a "roadmap" of a vehicle, with

leader-lines
that have a pictureLink at the end of each (50 in all) that capture data

from
a hidden sheet.
At this moment I have a code for each picture.
Can the code be written so that I have one, that will zoom in on any
pictureLink selected, instead of naming a specific picture?
Instead of ("Picture 9").Select
("Selected.Shapes") or something.....


Sub SC0x09()
ActiveSheet.Shapes("Picture 9").Select
ActiveWindow.Zoom = 75
End Sub

I have 50 of these working codes right now, but would like to keep the
amount of macros down, since I have 3 more of these spreadsheets to do

for
the same vehicle.
Any help is greatly appreciated
I must say, working with excel for 10 years, without knowing anything

about
macros (did not even know what one was), I've improved my overall skills
since I found this site last summer. This made my spreadsheets easier to

use
for the end user thanks to the great people and information on this

site!



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
Picture displayed when item selected in a different cell JB Bates[_2_] Excel Discussion (Misc queries) 2 November 4th 09 06:48 PM
Please help! Print Preview Zoom is Grayed Out...Doesn't zoom. PK Excel Discussion (Misc queries) 0 July 20th 09 03:33 PM
Can I show a picture depending on what data is selected in a cell Lesley Murray Excel Discussion (Misc queries) 3 April 12th 07 04:34 PM
Suppress double click behaviour when a picture on a worksheet is active/selected David Cuthill[_2_] Excel Programming 0 January 24th 05 11:45 PM
I know selected picture is a shape but typename says is picture Carlos Lozano Excel Programming 3 July 24th 04 05:44 PM


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