PC Review


Reply
Thread Tools Rate Thread

Copy structure chart

 
 
Martin
Guest
Posts: n/a
 
      31st Mar 2009
Hello,

I have the following code which i think is close but not close enough. I
want to get the value from a cell in one workbook, look up that value which
will be a tab name in another workbook, find a structure chart in that sheet
and paste it back in to the sheet I started with. This is what I have:

Dim RegionName As String

RegionName = Sheets("Qry_Basic_Information").Range("A2").Value
Windows("My Pack (Structure Charts).xls").Activate
Sheets(RegionName).Select

For Each myshape In ActiveSheet.Shapes
If myshape.Type = 12 Then myshape.Copy
Next myshape

Windows("My Pack.xls").Activate
Range("B6").Select
ActiveSheet.Paste

Can anyone point me in the right direction?

Many thanks in advance,

Martin
 
Reply With Quote
 
 
 
 
joel
Guest
Posts: n/a
 
      31st Mar 2009
See if this works. When you paste a shape you have to paste it and then move
it to the correct location. Vecause a shape sits ontop of the worksheet you
can't just position the shape to a range location, instead you have to use
the left and top properties like below.


Dim RegionName As String
Set StructChrts = Workbooks("My Pack (Structure Charts).xls")
Set PackBk = Workbooks("My Pack.xls")

With PackBk.Sheets("Qry_Basic_Information")
RegionName = .Range("A2").Value

With StructChrts.Sheets(RegionName)

For Each myshape In .Shapes
If myshape.Type = 12 Then

myshape.Copy
.Paste
Set NewShape = Selection
NewShape.Top = Range("B6").Top
NewShape.Left = Range("B6").Left
End If
Next myshape
End With
End With

"Martin" wrote:

> Hello,
>
> I have the following code which i think is close but not close enough. I
> want to get the value from a cell in one workbook, look up that value which
> will be a tab name in another workbook, find a structure chart in that sheet
> and paste it back in to the sheet I started with. This is what I have:
>
> Dim RegionName As String
>
> RegionName = Sheets("Qry_Basic_Information").Range("A2").Value
> Windows("My Pack (Structure Charts).xls").Activate
> Sheets(RegionName).Select
>
> For Each myshape In ActiveSheet.Shapes
> If myshape.Type = 12 Then myshape.Copy
> Next myshape
>
> Windows("My Pack.xls").Activate
> Range("B6").Select
> ActiveSheet.Paste
>
> Can anyone point me in the right direction?
>
> Many thanks in advance,
>
> Martin

 
Reply With Quote
 
Martin
Guest
Posts: n/a
 
      31st Mar 2009
Joel, thank you, worked a treat!

Martin

"joel" wrote:

> See if this works. When you paste a shape you have to paste it and then move
> it to the correct location. Vecause a shape sits ontop of the worksheet you
> can't just position the shape to a range location, instead you have to use
> the left and top properties like below.
>
>
> Dim RegionName As String
> Set StructChrts = Workbooks("My Pack (Structure Charts).xls")
> Set PackBk = Workbooks("My Pack.xls")
>
> With PackBk.Sheets("Qry_Basic_Information")
> RegionName = .Range("A2").Value
>
> With StructChrts.Sheets(RegionName)
>
> For Each myshape In .Shapes
> If myshape.Type = 12 Then
>
> myshape.Copy
> .Paste
> Set NewShape = Selection
> NewShape.Top = Range("B6").Top
> NewShape.Left = Range("B6").Left
> End If
> Next myshape
> End With
> End With
>
> "Martin" wrote:
>
> > Hello,
> >
> > I have the following code which i think is close but not close enough. I
> > want to get the value from a cell in one workbook, look up that value which
> > will be a tab name in another workbook, find a structure chart in that sheet
> > and paste it back in to the sheet I started with. This is what I have:
> >
> > Dim RegionName As String
> >
> > RegionName = Sheets("Qry_Basic_Information").Range("A2").Value
> > Windows("My Pack (Structure Charts).xls").Activate
> > Sheets(RegionName).Select
> >
> > For Each myshape In ActiveSheet.Shapes
> > If myshape.Type = 12 Then myshape.Copy
> > Next myshape
> >
> > Windows("My Pack.xls").Activate
> > Range("B6").Select
> > ActiveSheet.Paste
> >
> > Can anyone point me in the right direction?
> >
> > Many thanks in advance,
> >
> > Martin

 
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
structure chart animation JohnnyB Microsoft Powerpoint 1 25th Mar 2008 03:20 PM
Re: Format and Structure to a Line Chart Jon Peltier Microsoft Excel Charting 0 11th Jan 2007 04:51 PM
Wall chart of VB.net class structure? =?Utf-8?B?RGF2ZQ==?= Microsoft VB .NET 2 16th May 2006 05:00 PM
Copy a Structure =?Utf-8?B?UHJhdmluIFByYWJodQ==?= Microsoft VC .NET 3 21st Jun 2005 10:56 AM
Structure only copy Kaye Wykoff Microsoft Access 1 20th Jul 2003 07:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:55 PM.