D
dchman
I inherited an Access application which is used to prepare a powerpoint
presentation through VBA. Once the user picks a presentation and clicks go,
a powerpoint application is started and a template presentation loaded.
Through VBA, the slides in the presentation are updated with current data,
including charts embedded within the presentation. More often than not,
somewhere in the middle of the process, while attempting to update a chart on
a slide, error 462 will occur in one of the subs. If I trap the error
outside of the sub and just resume, the process will continue without the
error.
Anyone have any ideas on why the error is occurring and how to prevent it?
Oh yeah, one more clue? On my development machine, the error doesn't occur.
The error only seems to occur when the app is deployed to a server, which is
access through a citrix client. Some sample code is given below.
thanks
Dan
on the frmPP
Private sub cmdGo_Click()
on error goto err_Proc
call initPP()
call LoadPresTemplate()
DoSlide1
..... call other subs for other slides
pptPres.Save
pptApp.WindowsState = ppWindowMinimized
MsgBox "done"
set pptApp = nothing
exit_Proc:
exit sub
err_Proc:
dim errNum as long
errnum = err.number
Select Case (errNum)
Case 462
resume
Case Else
MsgBox(......)
Resume exit_Proc
End Select
end sub
Private DoSlide1()
dim curChart as Chart
dim curData as DataSheet
Set curSlide = pptApp.Presentations(pptPres.Name).Slides(1)
curSlide.Select
curSlide.Shapes(1).TextFrame.TextRange.text = "testslideone"
Set curChart = curSlide.Shapes(4).OLEFormat.Object
Set curData = curChart.Application.DataSheet
curData.Range("01").Value = "your score"
curChart.Axes(xlValue, xlPrimary).MaximumScale = 7
ChartBarFormat curChart, 1
curChart.Application.Update
set curChart = nothing
set curData = nothing
end Sub
' in a module
Declarations
public pptApp as PowerPoint.Application
public pptPres as PowerPoint.Presentation
public curSlide as PowerPoint.Slide
Public Sub InitPP()
set pptApp = new PowerPoint.Application
pptApp.Activate
end sub
Public LoadPresTemplate(strTemplateName as string, strFileName as string)
Set pptPres = pptApp.Presenations.Open(strTemplateName)
pptPres.SaveAs strFileName
end sub
presentation through VBA. Once the user picks a presentation and clicks go,
a powerpoint application is started and a template presentation loaded.
Through VBA, the slides in the presentation are updated with current data,
including charts embedded within the presentation. More often than not,
somewhere in the middle of the process, while attempting to update a chart on
a slide, error 462 will occur in one of the subs. If I trap the error
outside of the sub and just resume, the process will continue without the
error.
Anyone have any ideas on why the error is occurring and how to prevent it?
Oh yeah, one more clue? On my development machine, the error doesn't occur.
The error only seems to occur when the app is deployed to a server, which is
access through a citrix client. Some sample code is given below.
thanks
Dan
on the frmPP
Private sub cmdGo_Click()
on error goto err_Proc
call initPP()
call LoadPresTemplate()
DoSlide1
..... call other subs for other slides
pptPres.Save
pptApp.WindowsState = ppWindowMinimized
MsgBox "done"
set pptApp = nothing
exit_Proc:
exit sub
err_Proc:
dim errNum as long
errnum = err.number
Select Case (errNum)
Case 462
resume
Case Else
MsgBox(......)
Resume exit_Proc
End Select
end sub
Private DoSlide1()
dim curChart as Chart
dim curData as DataSheet
Set curSlide = pptApp.Presentations(pptPres.Name).Slides(1)
curSlide.Select
curSlide.Shapes(1).TextFrame.TextRange.text = "testslideone"
Set curChart = curSlide.Shapes(4).OLEFormat.Object
Set curData = curChart.Application.DataSheet
curData.Range("01").Value = "your score"
curChart.Axes(xlValue, xlPrimary).MaximumScale = 7
ChartBarFormat curChart, 1
curChart.Application.Update
set curChart = nothing
set curData = nothing
end Sub
' in a module
Declarations
public pptApp as PowerPoint.Application
public pptPres as PowerPoint.Presentation
public curSlide as PowerPoint.Slide
Public Sub InitPP()
set pptApp = new PowerPoint.Application
pptApp.Activate
end sub
Public LoadPresTemplate(strTemplateName as string, strFileName as string)
Set pptPres = pptApp.Presenations.Open(strTemplateName)
pptPres.SaveAs strFileName
end sub