#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Addin

Hi,

I have a workbook that I have used as an addin, how do I refer to it to do
something

i.e. if I have an image in the workbook in sheet1 how do I copy this to the
active workbook?

Thanks for any help!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Addin

You can use it just like any other workbook (well, almost). But in this case,
it's true.

Option Explicit
Sub testme()

Dim myFromPict As Picture
Dim myToPict As Picture
Dim myAspectRatio As Double

Set myFromPict _
= Workbooks("book1.xla").Worksheets("Sheet1").Pictur es("Picture 1")

myFromPict.Copy
With ActiveSheet
.Paste
Set myToPict = .Pictures(.Pictures.Count) 'last one added
With myToPict
myAspectRatio = .Width / .Height
End With
myToPict.ShapeRange.LockAspectRatio = msoTrue
myToPict.Left = .Range("A1").Left
myToPict.Top = .Range("A1").Top
myToPict.Height = .Range("a1:a5").Height
With myToPict
.Width = myAspectRatio * .Height
End With
End With
End Sub


Excel User wrote:

Hi,

I have a workbook that I have used as an addin, how do I refer to it to do
something

i.e. if I have an image in the workbook in sheet1 how do I copy this to the
active workbook?

Thanks for any help!


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Addin

Dave,

Cool - thanks for that !!

Regards,

"Dave Peterson" wrote in message
...
You can use it just like any other workbook (well, almost). But in this
case,
it's true.

Option Explicit
Sub testme()

Dim myFromPict As Picture
Dim myToPict As Picture
Dim myAspectRatio As Double

Set myFromPict _
= Workbooks("book1.xla").Worksheets("Sheet1").Pictur es("Picture 1")

myFromPict.Copy
With ActiveSheet
.Paste
Set myToPict = .Pictures(.Pictures.Count) 'last one added
With myToPict
myAspectRatio = .Width / .Height
End With
myToPict.ShapeRange.LockAspectRatio = msoTrue
myToPict.Left = .Range("A1").Left
myToPict.Top = .Range("A1").Top
myToPict.Height = .Range("a1:a5").Height
With myToPict
.Width = myAspectRatio * .Height
End With
End With
End Sub


Excel User wrote:

Hi,

I have a workbook that I have used as an addin, how do I refer to it to
do
something

i.e. if I have an image in the workbook in sheet1 how do I copy this to
the
active workbook?

Thanks for any help!


--

Dave Peterson


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
VB6 Com Addin versus VBA Addin meldrum_scotland Excel Programming 1 August 23rd 08 08:09 PM
setup project for Excel addin, won't register addin Gerry Excel Programming 0 October 31st 07 12:01 AM
Removing an Addin from the Tools Addin list. Trefor Excel Programming 2 August 25th 06 04:45 PM
Unshimmed Automation Addin and Shimmed COM Addin in same App Domai Brandon Excel Programming 0 June 27th 06 11:18 PM
Remove Excel AddIn from AddIn List !! Help carl Excel Programming 2 December 8th 03 03:36 PM


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