|
Topic Topic Hot Topic New Topic Locked Topic Sticky Topic Hidden |
[RISOLTO] riposizionare oggetti incollati con VBA |
Post Reply
|
| Author | |
house
Utente Base
Joined: 25/Mar/2008 Status: Offline Points: 90 |
Post Options
Thanks(0)
Quote Reply
Topic: [RISOLTO] riposizionare oggetti incollati con VBAPosted: 15/Giu/2012 at 23:51 |
|
Ciao,
di VBA capisco poco, però scopiazzando e adattando codice preso qua e la su internet sono riuscito, partendo da un file excel, a copiare ed incollare alcuni grafici nelle slide che mi interessano. Ora i grafici(oggetti) che incollo si posizionano tutti in alto a Sx della slide, anche parzialmente fuori della slide stessa. Nella slide 2 incollo 2 grafici che risultano sovrapposti. La domanda è; come faccio dopo aver incollato il mio oggetto nella slide a selezionarlo e posizionarlo dove voglio io ? Ovviamente le slide non sono tutte uguali percui ogni oggetto dovrà avere una sua posizione ben precisa. Di seguito il codice che sono risucito a fare..... Dim xlApp As Object Dim xlWrkBook As Object Dim lCurrSlide As Long 'seleziono la slide nr.2ActivePresentation.Slides(2).Select Set xlApp = CreateObject("Excel.Application") ' Open the Excel workbook ' Set xlWrkBook = xlApp.Workbooks.Open("D:\Ale_work\scienza\Excel\VBA_Ale experience_home.xlsm") 'in office Set xlWrkBook = xlApp.Workbooks.Open("C:\Users\Ale\Desktop\Ale\computer\MSOffice experience\Excel\VBA_Ale experience_home.xlsm") ' Copy picture of the 1st chart object onto the clipboard xlWrkBook.worksheets(1).ChartObjects(1).CopyPicture ' Get the slide number lCurrSlide = ActiveWindow.Selection.SlideRange.SlideNumber ' Paste the picture onto the PowerPoint slide. ActivePresentation.Slides(lCurrSlide).Shapes.Paste 'incollo il grafico 2 sulla slide 1 xlWrkBook.worksheets(1).ChartObjects(2).CopyPicture lCurrSlide = ActiveWindow.Selection.SlideRange.SlideNumber ActivePresentation.Slides(lCurrSlide).Shapes.Paste 'dopo aver incollato i grafici sulla slide 2 seleziono la slide 3, incollo e passo alla 4 ActivePresentation.Slides(3).Select xlWrkBook.worksheets(2).ChartObjects(1).CopyPicture lCurrSlide = ActiveWindow.Selection.SlideRange.SlideNumber ActivePresentation.Slides(lCurrSlide).Shapes.Paste ActivePresentation.Slides(4).Select xlWrkBook.worksheets("pluto").ChartObjects(1).CopyPicture lCurrSlide = ActiveWindow.Selection.SlideRange.SlideNumber ActivePresentation.Slides(lCurrSlide).Shapes.Paste 'DA QUI IN POI VORREI SELEZIONARE GLI OGGETTI INCOLLATI E METTERLI TOP/LEFT NELLA SLIDE DOVE VOGLIO IO ' Close the open workbook without saving changes xlWrkBook.Close (False) xlApp.Quit Set xlApp = Nothing Set xlWrkBook = Nothing End Sub grazie 1000 in anticipoEdited by house - 17/Giu/2012 at 14:40 |
|
|
House
|
|
![]() |
|
willy55
Veterano
Esperto di Access Joined: 03/Ago/2011 Location: Italy Status: Offline Points: 1224 |
Post Options
Thanks(0)
Quote Reply
Posted: 16/Giu/2012 at 22:43 |
|
Credo che questi link spieghino, ampliamente, come operare per riposizionare gli oggetti:
http://www.pptfaq.com/FAQ00860_Resetting_positions_of_shapes.htm http://www.excelforum.com/excel-programming/777190-resizing-the-image-in-ppt-using-vba.html http://excelhelphq.com/precisely-move-objects-shapes-in-powerpoint-in-vba http://code.msdn.microsoft.com/office/PowerPoint-2010-Change-2e90101e Bye
|
|
|
Willy
|
|
![]() |
|
house
Utente Base
Joined: 25/Mar/2008 Status: Offline Points: 90 |
Post Options
Thanks(0)
Quote Reply
Posted: 17/Giu/2012 at 14:40 |
|
Grazie Willi per i link.
In realtà sono risucito a sisolvere da solo copiando un pezzo di codice trovato nell'help VBA di powerpoint. ...tanta ma tanta soddisfazione adesso che funziona e fa quello che voglio io.... House |
|
|
House
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |