ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Move a "picture" object (https://www.excelbanter.com/excel-programming/271592-move-picture-object.html)

MacroMan

Move a "picture" object
 
Please help! I am using VBA in Excel XP with Windows 2000.

My program pastes a picture of a spreadsheet into a clean
sheet and then rotates the image 90 degrees.

Now I need to:

1. Programmatically always move the image (after rotating)
to the upper-most left-hand corner (so it covers
cell "A1"). Recorded code always uses "increment" and this
is not always uniform in result due to different sized
images. So, how do you do this?

2. I need to programmatically scale the image to fit on
one page (without scaling the entire document). How can I
calculate the scale size and resize the image
proportionately?

Your example code would be extremely appreciated. Thanks
in advance...

Tom Ogilvy

Move a "picture" object
 
Dim rng as Range
set rng = ActiveWindows.VisibleRange
with ActiveSheet.Pictures("Picture 1")
.top = rng.top
.Left = rng.left
.Width = rng.Width
.Height = rng.Height
End With

Might be what you want.

Regards,
Tom Ogilvy

"MacroMan" wrote in message
...
Please help! I am using VBA in Excel XP with Windows 2000.

My program pastes a picture of a spreadsheet into a clean
sheet and then rotates the image 90 degrees.

Now I need to:

1. Programmatically always move the image (after rotating)
to the upper-most left-hand corner (so it covers
cell "A1"). Recorded code always uses "increment" and this
is not always uniform in result due to different sized
images. So, how do you do this?

2. I need to programmatically scale the image to fit on
one page (without scaling the entire document). How can I
calculate the scale size and resize the image
proportionately?

Your example code would be extremely appreciated. Thanks
in advance...




MacroMan

Move a "picture" object
 
I think this is very close to what I'm looking for, but it
needs to be set to the current printable range and I'm
getting an 'Object required' error...???

Thanks much Tom, you save me often man...

-----Original Message-----
Dim rng as Range
set rng = ActiveWindows.VisibleRange
with ActiveSheet.Pictures("Picture 1")
.top = rng.top
.Left = rng.left
.Width = rng.Width
.Height = rng.Height
End With

Might be what you want.

Regards,
Tom Ogilvy

"MacroMan" wrote in message
...
Please help! I am using VBA in Excel XP with Windows

2000.

My program pastes a picture of a spreadsheet into a

clean
sheet and then rotates the image 90 degrees.

Now I need to:

1. Programmatically always move the image (after

rotating)
to the upper-most left-hand corner (so it covers
cell "A1"). Recorded code always uses "increment" and

this
is not always uniform in result due to different sized
images. So, how do you do this?

2. I need to programmatically scale the image to fit on
one page (without scaling the entire document). How can

I
calculate the scale size and resize the image
proportionately?

Your example code would be extremely appreciated. Thanks
in advance...



.


Tom Ogilvy

Move a "picture" object
 
Had an extra s on the end of ActiveWindow

Sub sizepicture()
Dim rng As Range
Set rng = ActiveWindow.VisibleRange
With ActiveSheet.Pictures("Picture 1")
.Top = rng.Top
.Left = rng.Left
.Width = rng.Width
.Height = rng.Height
End With
End Sub


I don't know what you want to do with the aspect setting. You might want
to play with that.

Regards,
Tom Ogilvy

"MacroMan" wrote in message
...
I think this is very close to what I'm looking for, but it
needs to be set to the current printable range and I'm
getting an 'Object required' error...???

Thanks much Tom, you save me often man...

-----Original Message-----
Dim rng as Range
set rng = ActiveWindows.VisibleRange
with ActiveSheet.Pictures("Picture 1")
.top = rng.top
.Left = rng.left
.Width = rng.Width
.Height = rng.Height
End With

Might be what you want.

Regards,
Tom Ogilvy

"MacroMan" wrote in message
...
Please help! I am using VBA in Excel XP with Windows

2000.

My program pastes a picture of a spreadsheet into a

clean
sheet and then rotates the image 90 degrees.

Now I need to:

1. Programmatically always move the image (after

rotating)
to the upper-most left-hand corner (so it covers
cell "A1"). Recorded code always uses "increment" and

this
is not always uniform in result due to different sized
images. So, how do you do this?

2. I need to programmatically scale the image to fit on
one page (without scaling the entire document). How can

I
calculate the scale size and resize the image
proportionately?

Your example code would be extremely appreciated. Thanks
in advance...



.





All times are GMT +1. The time now is 01:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com