Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Early bound to Late bound

How do I convert the following cod from Early bind to Late bind?

Public Sub ChartToPowerPoint()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim NewIndex As Integer
Dim ChartName As String
ChartName = ActiveSheet.Name
ActiveSheet.ChartObjects(ChartName).Activate
ActiveChart.ChartArea.Select
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlBitmap
Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewNormal
NewIndex = PPPres.Slides.Count + 1
PPPres.Slides.Add(Index:=NewIndex, Layout:=ppLayoutBlank).Select
Set PPSlide = PPPres.Slides
_(PPApp.ActiveWindow.Selection.SlideRange.SlideNum ber)
PPApp.ActiveWindow.ViewType = ppViewSlide
PPSlide.Shapes.Paste.Select
PPApp.ActiveWindow.Selection.ShapeRange.Height = 303.5
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
PPApp.ActiveWindow.ViewType = ppViewNormal
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub

Hope you can help me out.

Henk

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Early bound to Late bound

You need to change every variable declaration that references the
PowerPoint library to As Object. E.g., change

Dim PPApp As PowerPoint.Application
to
Dim PPApp As Object

Do this for all PowerPoint variables.

Then, you need to change all variables that are defined within
PowerPoint to their numeric equivalents. E.g,. change

ppViewNormal
to
3 ' this isn't the real value. look it up.

You can get the numeric values from the Object Browser (press F2 in
VBA). Search in the Object Browser for each ppt value.

Finally, once you have done all that, go to the Tools menu in VBA and
choose References. There, uncheck the reference to PowerPoint. Go to
the Debug menu and choose Compile and make sure it compiles cleanly.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 12 Feb 2009 03:47:01 -0800, Henk
wrote:

How do I convert the following cod from Early bind to Late bind?

Public Sub ChartToPowerPoint()
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim NewIndex As Integer
Dim ChartName As String
ChartName = ActiveSheet.Name
ActiveSheet.ChartObjects(ChartName).Activate
ActiveChart.ChartArea.Select
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:=xlBitmap
Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewNormal
NewIndex = PPPres.Slides.Count + 1
PPPres.Slides.Add(Index:=NewIndex, Layout:=ppLayoutBlank).Select
Set PPSlide = PPPres.Slides
_(PPApp.ActiveWindow.Selection.SlideRange.SlideNu mber)
PPApp.ActiveWindow.ViewType = ppViewSlide
PPSlide.Shapes.Paste.Select
PPApp.ActiveWindow.Selection.ShapeRange.Height = 303.5
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
PPApp.ActiveWindow.ViewType = ppViewNormal
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub

Hope you can help me out.

Henk

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Early bound to Late bound

tHenks Chip. I alread got a working solution from Bob :

"Bob Phillips" wrote:

Untested

Public Sub ChartToPowerPoint()
Const ppLayoutBlank As Long = 12
Const ppViewNormal As Long = 9
Const ppViewSlide As Long = 1
Application.ScreenUpdating = False
Dim PPApp As Object
Dim PPPres As Object
Dim PPSlide As Object
Dim NewIndex As Long
Dim ChartName As String
ChartName = ActiveSheet.Name
ActiveSheet.ChartObjects(ChartName).Activate
ActiveChart.ChartArea.Select
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen,
Format:=xlBitmap
Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewNormal
NewIndex = PPPres.Slides.Count + 1
PPPres.Slides.Add(Index:=NewIndex, Layout:=ppLayoutBlank).Select
Set PPSlide =
PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRa nge.SlideNumber)
PPApp.ActiveWindow.ViewType = ppViewSlide
PPSlide.Shapes.Paste.Select
PPApp.ActiveWindow.Selection.ShapeRange.Height = 303.5
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
PPApp.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True
PPApp.ActiveWindow.ViewType = ppViewNormal
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
End Sub

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
"Sort" macro in late bound code Ian[_4_] Excel Programming 3 November 13th 07 10:18 PM
Forms, Bound Columns etc Michael Beckinsale Excel Programming 1 March 24th 06 10:49 AM
Late Bound Object Click Events AWesner Excel Programming 7 December 24th 04 05:39 PM
Listbox with Bound Columns Vijay Bhatawdekar Excel Programming 0 February 11th 04 07:47 AM
Portability of early bound code - clarification Pete McCosh[_5_] Excel Programming 4 November 25th 03 03:53 PM


All times are GMT +1. The time now is 04:21 PM.

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"