A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Adding Powerpoint Comment with Visual Basic



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2004, 04:36 PM
Bjorn Haman
external usenet poster
 
Posts: n/a
Default Adding Powerpoint Comment with Visual Basic

Hi people,
perhaps someone can help me out here.

I'm currently developing an ActiveX DLL (in VB6) that will take a text
string and paste it as a comment on a powerpoint slide (Powerpoint 2000).
The following code works:

Dim oPowerPointApplication As powerpoint.Application
Set oPowerPointApplication = CreateObject("powerpoint.application")
DoEvents

oPowerPointApplication.Visible = msoTrue
DoEvents

Dim oPowerPointPresentation As powerpoint.Presentation
Set oPowerPointPresentation =
oPowerPointApplication.Presentations.Add(msoTrue)
DoEvents

oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal
DoEvents

Dim oPowerPointSlide As powerpoint.Slide
Set oPowerPointSlide = oPowerPointPresentation.Slides.Add(1, 1)
DoEvents

With oPowerPointSlide.Shapes.AddComment(100, 100, 150, 150)
.TextFrame.TextRange.Text = .TextFrame _
.TextRange.Text = "Test Comment"
End With

However,
I want to do this WITHOUT having to use the Powerpoint graphical interface
(IE remove the line oPowerPointApplication.Visible = msoTrue), but when i Do
this an error is raised at:
oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal (Because this
line requires the Powerpoint.application to be in a 'slide view'.

Does anyone have a clue on how to solve this?

Kind Regards
/Bjorn Haman,


  #2  
Old June 1st, 2004, 08:23 PM
Steve Rindsberg
external usenet poster
 
Posts: n/a
Default Adding Powerpoint Comment with Visual Basic

In article , Bjorn Haman wrote:
Hi people,
perhaps someone can help me out here.

I'm currently developing an ActiveX DLL (in VB6) that will take a text
string and paste it as a comment on a powerpoint slide (Powerpoint 2000).
The following code works:

Dim oPowerPointApplication As powerpoint.Application
Set oPowerPointApplication = CreateObject("powerpoint.application")
DoEvents

oPowerPointApplication.Visible = msoTrue
DoEvents

Dim oPowerPointPresentation As powerpoint.Presentation
Set oPowerPointPresentation =
oPowerPointApplication.Presentations.Add(msoTrue)
DoEvents

oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal
DoEvents

Dim oPowerPointSlide As powerpoint.Slide
Set oPowerPointSlide = oPowerPointPresentation.Slides.Add(1, 1)
DoEvents

With oPowerPointSlide.Shapes.AddComment(100, 100, 150, 150)
.TextFrame.TextRange.Text = .TextFrame _
.TextRange.Text = "Test Comment"
End With

However,
I want to do this WITHOUT having to use the Powerpoint graphical interface
(IE remove the line oPowerPointApplication.Visible = msoTrue), but when i Do
this an error is raised at:
oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal (Because this
line requires the Powerpoint.application to be in a 'slide view'.

Does anyone have a clue on how to solve this?


Comment out the line that raises an error? ;-)
Seriously, your code doesn't seem to require that the presentation be in normal
view for any reason, so don't force the issue, if forcing the issue forces an
error.



--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================

  #3  
Old June 2nd, 2004, 04:25 AM
Shyam Pillai
external usenet poster
 
Posts: n/a
Default Adding Powerpoint Comment with Visual Basic

Bjorn,
When your application is not visible, ActiveView object is not applicable.
You can comment it out.

However, the issue is that but you've stumbled across a bug I've encountered
in the past. You cannot use the AddComment method when the PowerPoint
document is not visible. I haven't come up with a solution for it. In 2002
the comments object was revamped and new Comment object was introduced which
works just fine.

--
Regards
Shyam Pillai

Image Importer Wizard: http://www.mvps.org/skp/iiw.htm


"Bjorn Haman" wrote in message
...
Hi people,
perhaps someone can help me out here.

I'm currently developing an ActiveX DLL (in VB6) that will take a text
string and paste it as a comment on a powerpoint slide (Powerpoint 2000).
The following code works:

Dim oPowerPointApplication As powerpoint.Application
Set oPowerPointApplication = CreateObject("powerpoint.application")
DoEvents

oPowerPointApplication.Visible = msoTrue
DoEvents

Dim oPowerPointPresentation As powerpoint.Presentation
Set oPowerPointPresentation =
oPowerPointApplication.Presentations.Add(msoTrue)
DoEvents

oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal
DoEvents

Dim oPowerPointSlide As powerpoint.Slide
Set oPowerPointSlide = oPowerPointPresentation.Slides.Add(1, 1)
DoEvents

With oPowerPointSlide.Shapes.AddComment(100, 100, 150, 150)
.TextFrame.TextRange.Text = .TextFrame _
.TextRange.Text = "Test Comment"
End With

However,
I want to do this WITHOUT having to use the Powerpoint graphical interface
(IE remove the line oPowerPointApplication.Visible = msoTrue), but when i
Do
this an error is raised at:
oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal (Because this
line requires the Powerpoint.application to be in a 'slide view'.

Does anyone have a clue on how to solve this?

Kind Regards
/Bjorn Haman,




  #4  
Old June 2nd, 2004, 08:11 AM
Bjorn Haman
external usenet poster
 
Posts: n/a
Default Adding Powerpoint Comment with Visual Basic

This was what I feared. The system we are building requires Powerpoint 2000
Anyway, I will have to start off using a minimized PPT window. I will look
into this some more though.

Thanks for you input, Shyam
(I've learnt a great deal from your tips on the internet in the past )



"Shyam Pillai" skrev i meddelandet
...
Bjorn,
When your application is not visible, ActiveView object is not applicable.
You can comment it out.

However, the issue is that but you've stumbled across a bug I've

encountered
in the past. You cannot use the AddComment method when the PowerPoint
document is not visible. I haven't come up with a solution for it. In 2002
the comments object was revamped and new Comment object was introduced

which
works just fine.

--
Regards
Shyam Pillai

Image Importer Wizard: http://www.mvps.org/skp/iiw.htm


"Bjorn Haman" wrote in message
...
Hi people,
perhaps someone can help me out here.

I'm currently developing an ActiveX DLL (in VB6) that will take a text
string and paste it as a comment on a powerpoint slide (Powerpoint

2000).
The following code works:

Dim oPowerPointApplication As powerpoint.Application
Set oPowerPointApplication = CreateObject("powerpoint.application")
DoEvents

oPowerPointApplication.Visible = msoTrue
DoEvents

Dim oPowerPointPresentation As powerpoint.Presentation
Set oPowerPointPresentation =
oPowerPointApplication.Presentations.Add(msoTrue)
DoEvents

oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal
DoEvents

Dim oPowerPointSlide As powerpoint.Slide
Set oPowerPointSlide = oPowerPointPresentation.Slides.Add(1, 1)
DoEvents

With oPowerPointSlide.Shapes.AddComment(100, 100, 150, 150)
.TextFrame.TextRange.Text = .TextFrame _
.TextRange.Text = "Test Comment"
End With

However,
I want to do this WITHOUT having to use the Powerpoint graphical

interface
(IE remove the line oPowerPointApplication.Visible = msoTrue), but when

i
Do
this an error is raised at:
oPowerPointApplication.ActiveWindow.ViewType = ppViewNormal (Because

this
line requires the Powerpoint.application to be in a 'slide view'.

Does anyone have a clue on how to solve this?

Kind Regards
/Bjorn Haman,






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.