Click here to Skip to main content
15,890,825 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB.net 2003 to retrieve data from Oracle database Pin
Christian Graus23-Oct-07 13:33
protectorChristian Graus23-Oct-07 13:33 
GeneralRe: VB.net 2003 to retrieve data from Oracle database Pin
kendo1724-Oct-07 0:23
kendo1724-Oct-07 0:23 
QuestionFile Default Location Pin
AAGTHosting23-Oct-07 11:17
AAGTHosting23-Oct-07 11:17 
AnswerRe: File Default Location Pin
pmarfleet23-Oct-07 11:52
pmarfleet23-Oct-07 11:52 
AnswerRe: File Default Location Pin
Dave Kreskowiak23-Oct-07 14:06
mveDave Kreskowiak23-Oct-07 14:06 
Questionvb6 code to enumerate installed devices Pin
vimu23-Oct-07 11:12
vimu23-Oct-07 11:12 
AnswerRe: vb6 code to enumerate installed devices Pin
Dave Kreskowiak23-Oct-07 14:07
mveDave Kreskowiak23-Oct-07 14:07 
QuestionPowerpoint Automation, process won't end after Quit() Pin
T-Smooth23-Oct-07 9:44
T-Smooth23-Oct-07 9:44 
I'm trying to do some Powerpoint automation from an ASP.NET page and generate/modify a slide. That piece of the code works fine but when it's all done running and even after I call the Quit() method on the powerpoint application object, POWERPOINT.EXE remains running and eventually this is causing problems. I've googled this extensively and nothing I've found has seemed to help. I really need this to work properly.

Here's my relevant code. I don't believe i'm using any Global references and I've even removed the COM reference from my website to use Late Binding instead in hopes that it would solve my problems as mentioned in this MSDN Article: http://support.microsoft.com/default.aspx?scid=kb;en-us;319832

Code:
Public Function GenerateDrillDown(ByVal strFileName As String) As Boolean
  Dim App As Object = Nothing
  Dim pres As Object = Nothing
  Dim slide As Object = Nothing

  Try
    App = CreateObject("PowerPoint.Application")
    App.Visible = -1 '  For debugging. Comment this out or set to 0 to keep the application from being visible.

    pres = App.Presentations.Open("C:\DevProjects\Docs\DrillDown.ppt", 0, -1, -1)
    slide = pres.Slides(1) ' There's only one slide in this ppt i'm using as the template.

    slide.Shapes.Item("Text Box 8").TextFrame.TextRange.Text = DecisionTitle ' These are all string variables
    slide.Shapes.Item("Text Box 13").TextFrame.TextRange.Text = Narrative
    slide.Shapes.Item("Text Box 14").TextFrame.TextRange.Text = Issues
    slide.Shapes.Item("Text Box 19").TextFrame.TextRange.Text = Scope

    If TopicType = 1 Then
     slide.Shapes.Item("Autoshape 9").TextFrame.TextRange.Text = IDNumber.ToString()
     slide.Shapes.Item("Autoshape 9").Visible = -1
     slide.Shapes.Item("Autoshape 56").Visible = 0
    ElseIf TopicType = 2 Then
      slide.Shapes.Item("Autoshape 56").TextFrame.TextRange.Text = "ST" & IDNumber.ToString()
      slide.Shapes.Item("Autoshape 56").Visible = -1
      slide.Shapes.Item("Autoshape 9").Visible = 0
    End If

    pres.SaveAs(strFilename, 1, 0)
  Catch ex As Exception
    Return False
   Finally
     ' Most of this is coming from another article I found online to help combat the problem of open references with office automation.
     GC.Collect()
     GC.WaitForPendingFinalizers()
     GC.Collect() ' Intentionally repeated
     GC.WaitForPendingFinalizers() 
     If Not slide Is Nothing Then
      Marshal.FinalReleaseComObject(slide)
      slide = Nothing
     End If
    
    If Not pres Is Nothing Then
      pres.Close()
      Masrhal.FinalReleaseComObject(pres)
      pres = Nothing
    End If
    
    If Not App Is Nothing Then
      App.Quit()  ' This doesn't do anything, no errors but ap stays open
      Marshal.FInalReleaseComObject(App)
      App = Nothing
    End If
  End Try

  Return True
End Function


Please give me some guidance as this is an important piece of functionality required by my project. Thanks!
AnswerRe: Powerpoint Automation, process won't end after Quit() Pin
Dave Kreskowiak23-Oct-07 10:05
mveDave Kreskowiak23-Oct-07 10:05 
QuestionSave a Blank Picture box to database Pin
aransiola23-Oct-07 8:49
aransiola23-Oct-07 8:49 
AnswerRe: Save a Blank Picture box to database Pin
Dave Kreskowiak23-Oct-07 9:14
mveDave Kreskowiak23-Oct-07 9:14 
GeneralRe: Save a Blank Picture box to database Pin
Teddy3223-Oct-07 11:43
Teddy3223-Oct-07 11:43 
GeneralRe: Save a Blank Picture box to database Pin
aransiola23-Oct-07 22:32
aransiola23-Oct-07 22:32 
GeneralRe: Save a Blank Picture box to database Pin
Dave Kreskowiak24-Oct-07 4:22
mveDave Kreskowiak24-Oct-07 4:22 
QuestionWindow Form Location vb.net2005 Pin
aransiola23-Oct-07 8:31
aransiola23-Oct-07 8:31 
AnswerRe: Window Form Location vb.net2005 Pin
Dave Kreskowiak23-Oct-07 9:10
mveDave Kreskowiak23-Oct-07 9:10 
GeneralRe: Window Form Location vb.net2005 Pin
aransiola23-Oct-07 22:27
aransiola23-Oct-07 22:27 
GeneralRe: Window Form Location vb.net2005 Pin
Dave Kreskowiak24-Oct-07 4:29
mveDave Kreskowiak24-Oct-07 4:29 
AnswerRe: Window Form Location vb.net2005 Pin
Tom Deketelaere23-Oct-07 20:41
professionalTom Deketelaere23-Oct-07 20:41 
GeneralRe: Window Form Location vb.net2005 Pin
aransiola24-Oct-07 9:34
aransiola24-Oct-07 9:34 
QuestionCode Is Not Working . Pin
Dan Suthar23-Oct-07 6:15
professionalDan Suthar23-Oct-07 6:15 
AnswerRe: Code Is Not Working . Pin
pmarfleet23-Oct-07 6:56
pmarfleet23-Oct-07 6:56 
AnswerRe: Code Is Not Working . Pin
Scott Dorman23-Oct-07 7:12
professionalScott Dorman23-Oct-07 7:12 
GeneralRe: Code Is Not Working . Pin
Dan Suthar24-Oct-07 6:22
professionalDan Suthar24-Oct-07 6:22 
GeneralRe: Code Is Not Working . Pin
Scott Dorman24-Oct-07 12:34
professionalScott Dorman24-Oct-07 12:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.