Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Get a reference to the last object pasted

I am using the following code line to paste an image from the clipboard into
the current Excel sheet:

ActiveSheet.PasteSpecial(Format:="Picture (Enhanced Metafile)", Link:=False,
DisplayAsIcon:=False)

How can I modify this so that I can return a reference to the object just
pasted, or after posting, how can I return a reference?

Thanks much...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Get a reference to the last object pasted

See my reply to your earlier post.
I gave example referring to the earlier pasted pix.

Sharad

"quartz" wrote in message
...
I am using the following code line to paste an image from the clipboard
into
the current Excel sheet:

ActiveSheet.PasteSpecial(Format:="Picture (Enhanced Metafile)",
Link:=False,
DisplayAsIcon:=False)

How can I modify this so that I can return a reference to the object just
pasted, or after posting, how can I return a reference?

Thanks much...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Get a reference to the last object pasted

Thanks so much Sharad. I didn't see your earlier post before posting this one.

One more question: some of my graphics overlay vertical page breaks and
therefore an image may appear broken over two pages. Do you, by any chance,
have a function that can correct for this? I know this is a tough one...

Thanks again in any case!

"Sharad Naik" wrote:

See my reply to your earlier post.
I gave example referring to the earlier pasted pix.

Sharad

"quartz" wrote in message
...
I am using the following code line to paste an image from the clipboard
into
the current Excel sheet:

ActiveSheet.PasteSpecial(Format:="Picture (Enhanced Metafile)",
Link:=False,
DisplayAsIcon:=False)

How can I modify this so that I can return a reference to the object just
pasted, or after posting, how can I return a reference?

Thanks much...




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Get a reference to the last object pasted

After the Top + Height line
add following

DoEvents
IF shpSh1.Width 432 Then
shpSh1.Width = 432
End If
DoEvents

Note: DoEvents above is by experience. If by anymeans excel is displaying
default
pagebreaks (either through code if HPageBreaks or VPageBreaks protperty
is used or user goes in to PageBreak View) Excel somehow changes its
scale of Points. .Height=1 in normal case may aactually become 3 points.
DoEvents solves this problem.

Sharad


"quartz" wrote in message
...
Thanks so much Sharad. I didn't see your earlier post before posting this
one.

One more question: some of my graphics overlay vertical page breaks and
therefore an image may appear broken over two pages. Do you, by any
chance,
have a function that can correct for this? I know this is a tough one...

Thanks again in any case!

"Sharad Naik" wrote:

See my reply to your earlier post.
I gave example referring to the earlier pasted pix.

Sharad

"quartz" wrote in message
...
I am using the following code line to paste an image from the clipboard
into
the current Excel sheet:

ActiveSheet.PasteSpecial(Format:="Picture (Enhanced Metafile)",
Link:=False,
DisplayAsIcon:=False)

How can I modify this so that I can return a reference to the object
just
pasted, or after posting, how can I return a reference?

Thanks much...






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Get a reference to the last object pasted

Well the earlier code, will distort the pircture.
What you can do is:
Ir shpSh1.Width 432 Then
Dim sWd
sWd = shpSh1.Width
shpSh1.Width = 432
shpSh1.Height = Fix(shpSh1.Height * 432 / sWd)
End If

Above is assuming that the page orientation is Portrait.
If it is LandScape, replace 432 by 672.

Sharad

"Sharad Naik" wrote in message
...
After the Top + Height line
add following

DoEvents
IF shpSh1.Width 432 Then
shpSh1.Width = 432
End If
DoEvents

Note: DoEvents above is by experience. If by anymeans excel is displaying
default
pagebreaks (either through code if HPageBreaks or VPageBreaks protperty
is used or user goes in to PageBreak View) Excel somehow changes its
scale of Points. .Height=1 in normal case may aactually become 3 points.
DoEvents solves this problem.

Sharad


"quartz" wrote in message
...
Thanks so much Sharad. I didn't see your earlier post before posting this
one.

One more question: some of my graphics overlay vertical page breaks and
therefore an image may appear broken over two pages. Do you, by any
chance,
have a function that can correct for this? I know this is a tough one...

Thanks again in any case!

"Sharad Naik" wrote:

See my reply to your earlier post.
I gave example referring to the earlier pasted pix.

Sharad

"quartz" wrote in message
...
I am using the following code line to paste an image from the clipboard
into
the current Excel sheet:

ActiveSheet.PasteSpecial(Format:="Picture (Enhanced Metafile)",
Link:=False,
DisplayAsIcon:=False)

How can I modify this so that I can return a reference to the object
just
pasted, or after posting, how can I return a reference?

Thanks much...









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default Get a reference to the last object pasted

Thanks again Sharad!

Please don't think I am taking advantage of a great thing here, but is there
a solution for horizontal page breaks also? Most of my graphics are
vertically arranged, and many of them overlay the horizontal breaks as well.

Any ideas on this?

"Sharad Naik" wrote:

Well the earlier code, will distort the pircture.
What you can do is:
Ir shpSh1.Width 432 Then
Dim sWd
sWd = shpSh1.Width
shpSh1.Width = 432
shpSh1.Height = Fix(shpSh1.Height * 432 / sWd)
End If

Above is assuming that the page orientation is Portrait.
If it is LandScape, replace 432 by 672.

Sharad

"Sharad Naik" wrote in message
...
After the Top + Height line
add following

DoEvents
IF shpSh1.Width 432 Then
shpSh1.Width = 432
End If
DoEvents

Note: DoEvents above is by experience. If by anymeans excel is displaying
default
pagebreaks (either through code if HPageBreaks or VPageBreaks protperty
is used or user goes in to PageBreak View) Excel somehow changes its
scale of Points. .Height=1 in normal case may aactually become 3 points.
DoEvents solves this problem.

Sharad


"quartz" wrote in message
...
Thanks so much Sharad. I didn't see your earlier post before posting this
one.

One more question: some of my graphics overlay vertical page breaks and
therefore an image may appear broken over two pages. Do you, by any
chance,
have a function that can correct for this? I know this is a tough one...

Thanks again in any case!

"Sharad Naik" wrote:

See my reply to your earlier post.
I gave example referring to the earlier pasted pix.

Sharad

"quartz" wrote in message
...
I am using the following code line to paste an image from the clipboard
into
the current Excel sheet:

ActiveSheet.PasteSpecial(Format:="Picture (Enhanced Metafile)",
Link:=False,
DisplayAsIcon:=False)

How can I modify this so that I can return a reference to the object
just
pasted, or after posting, how can I return a reference?

Thanks much...








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 212
Default Get a reference to the last object pasted

Here you go, for Protrait Page:

SubCopyPix()
Dim shp As Shape, shpSh1 As Shape
Dim i, j
Dim wdBeTop As Long, wdBeBtm As Long
Sheet1.Select
Sheet1.Range("A1").Select
j = 1
For Each shp In Sheet2.Shapes
shp.CopyPicture
Sheet1.Paste
i = Sheet1.Shapes.Count
Set shpSh1 = Sheet1.Shapes(i)
'Below If para :- In case a single
'pictrue height is more than a page
If shpSh1.Height 714 Then
DoEvents
shpSh1.Width = shpSh1.Width * 714 / shpSh1.Height
shpSh1.Height = 714
DoEvents
End If

If i 1 Then
DoEvents
shpSh1.Left = Sheet1.Shapes(i - 1).Left
wdBeTop = Sheet1.Shapes(i - 1).Top _
+ Sheet1.Shapes(i - 1).Height
wdBeBtm = wdBeTop + shpSh1.Height
If wdBeBtm j * 714 Then
wdBeTop = j * 714
j = j + 1
End If
shpSh1.Top = wdBeTop
If shpSh1.Width 432 Then
DoEvents
Dim sWd
sWd = shpSh1.Width
shpSh1.Width = 432
shpSh1.Height = Fix(shpSh1.Height * 432 / sWd)
DoEvents
End If
DoEvents
End If
Next
End Sub

For LandScape page:
Replace 714 by 459 AND
Replace 432 by 672.

Hope that helps

Sharad

"quartz" wrote in message
...
Thanks again Sharad!

Please don't think I am taking advantage of a great thing here, but is
there
a solution for horizontal page breaks also? Most of my graphics are
vertically arranged, and many of them overlay the horizontal breaks as
well.

Any ideas on this?

"Sharad Naik" wrote:

Well the earlier code, will distort the pircture.
What you can do is:
Ir shpSh1.Width 432 Then
Dim sWd
sWd = shpSh1.Width
shpSh1.Width = 432
shpSh1.Height = Fix(shpSh1.Height * 432 / sWd)
End If

Above is assuming that the page orientation is Portrait.
If it is LandScape, replace 432 by 672.

Sharad

"Sharad Naik" wrote in message
...
After the Top + Height line
add following

DoEvents
IF shpSh1.Width 432 Then
shpSh1.Width = 432
End If
DoEvents

Note: DoEvents above is by experience. If by anymeans excel is
displaying
default
pagebreaks (either through code if HPageBreaks or VPageBreaks protperty
is used or user goes in to PageBreak View) Excel somehow changes its
scale of Points. .Height=1 in normal case may aactually become 3
points.
DoEvents solves this problem.

Sharad


"quartz" wrote in message
...
Thanks so much Sharad. I didn't see your earlier post before posting
this
one.

One more question: some of my graphics overlay vertical page breaks
and
therefore an image may appear broken over two pages. Do you, by any
chance,
have a function that can correct for this? I know this is a tough
one...

Thanks again in any case!

"Sharad Naik" wrote:

See my reply to your earlier post.
I gave example referring to the earlier pasted pix.

Sharad

"quartz" wrote in message
...
I am using the following code line to paste an image from the
clipboard
into
the current Excel sheet:

ActiveSheet.PasteSpecial(Format:="Picture (Enhanced Metafile)",
Link:=False,
DisplayAsIcon:=False)

How can I modify this so that I can return a reference to the
object
just
pasted, or after posting, how can I return a reference?

Thanks much...










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
Pasted Word object getting cut off dpatcep Excel Discussion (Misc queries) 0 August 26th 09 07:40 PM
How to fix a Excel corrupt object pasted into Word? hazel Excel Worksheet Functions 1 July 28th 06 06:57 PM
Cell reference update when copied and pasted Dave Excel Worksheet Functions 1 April 5th 06 08:52 PM
Why does a pasted object in Excel sometimes print upside down? Mel Excel Discussion (Misc queries) 2 December 2nd 05 02:07 PM
Draw object pasted into Excel cannot be deleted or moved Elaine Merchant Excel Discussion (Misc queries) 0 January 7th 05 09:35 PM


All times are GMT +1. The time now is 04:13 AM.

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"