thanks
Scott
Hard to say w/o seeing actual code or knowing what you're trying to do with the
active window (or whether you even need a reference to it).
If you're trying to do something to the first slide, you might be able to drill
down from a reference to the PowerPoint app to .ActivePresentation.Slides(1)
-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Live and in personable in the Help Center at PowerPoint Live
Sept 21-24, San Diego CA, USA
www.pptlive.com
Public Function TriFilter2()
Dim Continue As Integer
Dim pr As MSProject.Application
Dim pp As Object
Dim ppwindow As PowerPoint.DocumentWindow
Dim oPres As PowerPoint.Presentation
Dim waitTime As Integer
Dim waitTime2 As Integer
'Puts it in an infinite loop
Continue = 1
'Runs appropriate queries (which create tables), then opens Project
'and PowerPoint
While Continue = 1
DoCmd.SetWarnings False
DoCmd.OpenQuery "SMquery", acViewNormal, acEdit
DoCmd.OpenQuery "SMdelete", acViewNormal, acEdit
DoCmd.OpenQuery "PIPquery", acViewNormal, acEdit
DoCmd.OpenQuery "PIPdelete", acViewNormal, acEdit
DoCmd.OpenQuery "PLBquery", acViewNormal, acEdit
DoCmd.OpenQuery "PLBdelete", acViewNormal, acEdit
Set pr = New MSProject.Application
'pr.Visible = True
pr.FileOpen ("U:\Estimating Log\Est Schedule\Take-offbackup.mpp")
ImportAll
Set pp = CreateObject("powerpoint.application")
pp.Visible = True
pp.Presentations.Open FileName:="C:\Documents and
Settings\deckers\Desktop\ScheduleOutputbackup.pptm"
'Set oPres = PptApp.Presentations.Open("C:\Documents and
Settings\deckers\Desktop\ScheduleOutputbackup.pptm")
'pp.Active = True
'Set ppwindow = pp.Presentation.Window
'Set ActiveWindow.Caption = "ScheduleOutputbackup.pptm"
'Set ActiveWindow = pp.Presentation.Window
'pp.Activate
'Presentations.Activate
'ActiveWindow = Powerpoint.ActivePresentation.Windows(1)
CreateShow
DoCmd.SetWarnings True
Wend
End Function
Sub CreateShow()
'Declare the variables
Dim oSlide As Slide
Dim oPicture1 As Shape
Dim oPicture2 As Shape
Dim oPicture3 As Shape
Dim oPicture4 As Shape
Dim oPicture5 As Shape
Dim oPicture6 As Shape
'Dim oPres As PowerPoint.Presentation
'Powerpoint.Application.Activate
'Set oPres = PowerPoint.Presentations(1)
'oPres.Application.Activate
DisplayAlerts = False
ScreenUpdating = False
'**********
'PICTURE 2
'**********
' Change slide index position to the first slide
'HAS PROBLEM WITH THE FOLLOWING LINE OF CODE; THE ACTIVE WINDOW IS 'NOT
POWERPOINT
ActiveWindow.View.GotoSlide 2
' Set oSlide to the first slide in the presentation.
Set oSlide = ActiveWindow.Presentation.Slides(2)
' Set oPicture to the picture file on your computer. Set Link To
' File to false, Save With Document to true, and place it in the
' upper left-hand corner of the slide, sized to 1 by 1 points.
Set oPicture2 = oSlide.Shapes.AddPicture("U:\Estimating Log\Est
Schedule\Directory\TOT\ALLTwoWeeks.gif", _
msoFalse, msoTrue, 1, 1, 1, 1)
' Now scale the picture to full size, with "Relative to original
' picture size" set to true for both height and width.
oPicture2.ScaleHeight 1, msoTrue
oPicture2.ScaleWidth 1, msoTrue
'MORE CODE AFTER THAT, BUT NEVER MAKES IT ANY FARTHER
End Sub
' Move the picture to the center of the slide. Select it.
With ActivePresentation.PageSetup
oPicture2.Select
End With
'Sizes the photo to span the entire width
With ActiveWindow.Selection.ShapeRange(1)
oPicture2.LockAspectRatio = msoFalse
oPicture2.Left = 0
oPicture2.Top = 0
oPicture2.Width = 720
End With
OK, that's a start. What're you trying to do with the window though?
CreateShow is a function/sub you're calling?
Set pp = CreateObject("powerpoint.application")
pp.Visible = True
' change pptapp to pp, make sure this all
' goes on one line
Set oPres = pp.Presentations.Open("C:\Documents and
Settings\deckers\Desktop\ScheduleOutputbackup.pptm")
With oPres.SlideShowSettings
' settings here as desired
'.ShowType = ppShowTypeSpeaker
'.LoopUntilStopped = msoFalse
'.ShowWithNarration = msoTrue
'.ShowWithAnimation = msoTrue
'.RangeType = ppShowAll
'.AdvanceMode = ppSlideShowUseSlideTimings
'.PointerColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
.Run
End With
That should start the slide show (activating it in the process) but if you need to
activate the window again, this should do it:
oPres.SlideShowWindow.Activate
if i could pass oPres to CreateShow, then i think i could use
oPres.slides(1), but right now it's not letting me do that.
right now i can't use
oPres.SlideShowWindow.Activate
because either there is no slideshowwindow in the main sub, or in the
CreateShow sub it doesn't know what oPres is because i'm having trouble
passing it.
thanks!
scott
As it's written, no.
But change this:
Sub CreateShow()
to this:
Sub CreateShow(oPres as Presentation)
or
Sub CreateShow(oPres as Object)
and you should be good.
Call it using:
Call CreateShow(oPres)
from your main routine
'Declare the variables
Dim oSlide As Slide
Dim oPicture1 As Shape
Dim oPicture2 As Shape
Dim oPicture3 As Shape
Dim oPicture4 As Shape
Dim oPicture5 As Shape
Dim oPicture6 As Shape
'Dim oPres As PowerPoint.Presentation
'Powerpoint.Application.Activate
'Set oPres = PowerPoint.Presentations(1)
'oPres.Application.Activate
DisplayAlerts = False
ScreenUpdating = False
>
thanks