ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PowerPoint Chart Preview in VBA Userform (https://www.excelbanter.com/excel-programming/408423-powerpoint-chart-preview-vba-userform.html)

[email protected]

PowerPoint Chart Preview in VBA Userform
 
Hello everyone,

I am attempting to add functionality to an Excel VBA macro that will
allow a user to build a Powerpoint chart using various named ranges
and such in Excel. I thought it would be good to have a "preview" of
what the final product would look like in the user form that acts as
the user's interface. There doesn't seem to be a lot of information on
this (or at least I cannot find it). Is this possible without using
API calls?

I was thinking along the lines of programatically creating a
powerpoint application object, adding a new chart, etc, and somehow
embedding a "view" from powerpoint into the user form. There doesn't
seem to be anything related to PowerPoint in the "Additional
Controls..." dialog so I am at a loss.

Shyam Pillai

PowerPoint Chart Preview in VBA Userform
 
If you are using PPT 2003 or earlier look up the MS graph object and
automating it in context of PowerPoint. You will find plenty of examples on
MSDN. If it is PPT 2007 then native charts are broken in the object model.

Regards,
Shyam Pillai

Handout Wizard
http://skp.mvps.org/how


wrote in message
...
Hello everyone,

I am attempting to add functionality to an Excel VBA macro that will
allow a user to build a Powerpoint chart using various named ranges
and such in Excel. I thought it would be good to have a "preview" of
what the final product would look like in the user form that acts as
the user's interface. There doesn't seem to be a lot of information on
this (or at least I cannot find it). Is this possible without using
API calls?

I was thinking along the lines of programatically creating a
powerpoint application object, adding a new chart, etc, and somehow
embedding a "view" from powerpoint into the user form. There doesn't
seem to be anything related to PowerPoint in the "Additional
Controls..." dialog so I am at a loss.



[email protected]

PowerPoint Chart Preview in VBA Userform
 
I am using PPT2003.

I think my terminology may have thrown things off. I want to preview
the entire slide, not just a chart/graph.

I kind of worked up a hack that is working, but it not very optimal. I
create a powerpoint object, new presentation, build a slide, export it
as a picture file, then link a picture viewer on the form to the
export, then kill the powerpoint object. I'd like to avoid writing a
file to the hard drive though.

On Mar 28, 8:15 am, "Shyam Pillai" wrote:
If you are using PPT 2003 or earlier look up the MS graph object and
automating it in context of PowerPoint. You will find plenty of examples on
MSDN. If it is PPT 2007 then native charts are broken in the object model.

Regards,
Shyam Pillai

Handout Wizardhttp://skp.mvps.org/how

wrote in message

...

Hello everyone,


I am attempting to add functionality to an Excel VBA macro that will
allow a user to build a Powerpoint chart using various named ranges
and such in Excel. I thought it would be good to have a "preview" of
what the final product would look like in the user form that acts as
the user's interface. There doesn't seem to be a lot of information on
this (or at least I cannot find it). Is this possible without using
API calls?


I was thinking along the lines of programatically creating a
powerpoint application object, adding a new chart, etc, and somehow
embedding a "view" from powerpoint into the user form. There doesn't
seem to be anything related to PowerPoint in the "Additional
Controls..." dialog so I am at a loss.



Shyam Pillai

PowerPoint Chart Preview in VBA Userform
 
John,
This might interest you
Create a presentation of slide images (w/o using API or exporting &
re-inserting images)
http://skp.mvps.org/pptxp003.htm


Regards,
Shyam Pillai

Handout Wizard
http://skp.mvps.org/how

wrote in message
...
I am using PPT2003.

I think my terminology may have thrown things off. I want to preview
the entire slide, not just a chart/graph.

I kind of worked up a hack that is working, but it not very optimal. I
create a powerpoint object, new presentation, build a slide, export it
as a picture file, then link a picture viewer on the form to the
export, then kill the powerpoint object. I'd like to avoid writing a
file to the hard drive though.

On Mar 28, 8:15 am, "Shyam Pillai" wrote:
If you are using PPT 2003 or earlier look up the MS graph object and
automating it in context of PowerPoint. You will find plenty of examples
on
MSDN. If it is PPT 2007 then native charts are broken in the object
model.

Regards,
Shyam Pillai

Handout Wizardhttp://skp.mvps.org/how

wrote in message

...

Hello everyone,


I am attempting to add functionality to an Excel VBA macro that will
allow a user to build a Powerpoint chart using various named ranges
and such in Excel. I thought it would be good to have a "preview" of
what the final product would look like in the user form that acts as
the user's interface. There doesn't seem to be a lot of information on
this (or at least I cannot find it). Is this possible without using
API calls?


I was thinking along the lines of programatically creating a
powerpoint application object, adding a new chart, etc, and somehow
embedding a "view" from powerpoint into the user form. There doesn't
seem to be anything related to PowerPoint in the "Additional
Controls..." dialog so I am at a loss.




[email protected]

PowerPoint Chart Preview in VBA Userform
 
Thanks, except I am displaying the image in a VBA UserForm, not on a
slide.

On Mar 28, 10:39*am, "Shyam Pillai" wrote:
John,
This might interest you
Create a presentation of slide images (w/o using API *or exporting &
re-inserting images)http://skp.mvps.org/pptxp003.htm

Regards,
Shyam Pillai

Handout Wizardhttp://skp.mvps.org/how

wrote in message

...

I am using PPT2003.


I think my terminology may have thrown things off. I want to preview
the entire slide, not just a chart/graph.


I kind of worked up a hack that is working, but it not very optimal. I
create a powerpoint object, new presentation, build a slide, export it
as a picture file, then link a picture viewer on the form to the
export, then kill the powerpoint object. I'd like to avoid writing a
file to the hard drive though.


On Mar 28, 8:15 am, "Shyam Pillai" wrote:
If you are using PPT 2003 or earlier look up the MS graph object and
automating it in context of PowerPoint. You will find plenty of examples
on
MSDN. If it is PPT 2007 then native charts are broken in the object
model.


Regards,
Shyam Pillai


Handout Wizardhttp://skp.mvps.org/how


wrote in message


....


Hello everyone,


I am attempting to add functionality to an Excel VBA macro that will
allow a user to build a Powerpoint chart using various named ranges
and such in Excel. I thought it would be good to have a "preview" of
what the final product would look like in the user form that acts as
the user's interface. There doesn't seem to be a lot of information on
this (or at least I cannot find it). Is this possible without using
API calls?


I was thinking along the lines of programatically creating a
powerpoint application object, adding a new chart, etc, and somehow
embedding a "view" from powerpoint into the user form. There doesn't
seem to be anything related to PowerPoint in the "Additional
Controls..." dialog so I am at a loss.



Steve Rindsberg

PowerPoint Chart Preview in VBA Userform
 
In article ,
wrote:
Thanks, except I am displaying the image in a VBA UserForm, not on a
slide.


Have a look he

http://skp.mvps.org/vb/pptvbwnd.htm

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================



[email protected]

PowerPoint Chart Preview in VBA Userform
 
Thanks, that looks closer to what I am trying to do. I will check it
out.

Thanks, except I am displaying the image in a VBA UserForm, not on a
slide.


Have a look he

http://skp.mvps.org/vb/pptvbwnd.htm

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: *www.pptfaq.com
PPTools: *www.pptools.com
================================================



[email protected]

PowerPoint Chart Preview in VBA Userform
 
On Mar 31, 3:09*pm, Steve Rindsberg wrote:
In article , *
wrote:

Thanks, except I am displaying the image in a VBA UserForm, not on a
slide.


Have a look he

http://skp.mvps.org/vb/pptvbwnd.htm

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: *www.pptfaq.com
PPTools: *www.pptools.com
================================================


While this code looks closer to getting where I would like to go, I am
using VBA not VB, and cannot open the VB project file nor the form
enclosed in the VBA editor. I've tried to convert as much as possible
but I am stuck on what control is on the form to display the show in,
and if it is even possible to use this control in VBA.

Steve Rindsberg

PowerPoint Chart Preview in VBA Userform
 
In article ,
wrote:
On Mar 31, 3:09*pm, Steve Rindsberg wrote:
In article , *
wrote:

Thanks, except I am displaying the image in a VBA UserForm, not on a
slide.


Have a look he

http://skp.mvps.org/vb/pptvbwnd.htm

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: *www.pptfaq.com
PPTools: *www.pptools.com
================================================


While this code looks closer to getting where I would like to go, I am
using VBA not VB, and cannot open the VB project file nor the form
enclosed in the VBA editor. I've tried to convert as much as possible
but I am stuck on what control is on the form to display the show in,
and if it is even possible to use this control in VBA.


You can open the form file (.FRM) in a text editor and extract the code that way.

The form seems only to have a couple of buttons, a frame and a label, so it doesn't
look like anything you couldn't replicate in VBA. Haven't tried it myself, so I
can't say whether you'd run into other issues though.


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================



[email protected]

PowerPoint Chart Preview in VBA Userform
 
Well, I got it working, sort of... It displays the show, small and the
size of the frame, but not in the frame... It displays at the top left
corner of the monitor. no errors though!

If you are interested in trying it:
http://www.rickycampbell.com/temp/TestPPShow.xls

I had to make a few mods, mostly because it is VBA and not VB. If
anyone has a suggestion...

On Apr 1, 2:34*pm, Steve Rindsberg wrote:
While this code looks closer to getting where I would like to go, I am
using VBA not VB, and cannot open the VB project file nor the form
enclosed in the VBA editor. I've tried to convert as much as possible
but I am stuck on what control is on the form to display the show in,
and if it is even possible to use this control in VBA.


You can open the form file (.FRM) in a text editor and extract the code that way.

The form seems only to have a couple of buttons, a frame and a label, so it doesn't
look like anything you couldn't replicate in VBA. *Haven't tried it myself, so I
can't say whether you'd run into other issues though.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: *www.pptfaq.com
PPTools: *www.pptools.com
================================================



Andy Pope

PowerPoint Chart Preview in VBA Userform
 
Hi,

The reason the ppt is displaying top left of screen is the userform
handle is incorrect. In VBA userform do not have a built-in hWnd
property. So you need to use FindWindow to get the handle.
It will appear top left of userform. Forms 2.0 controls are windowless
controls and as such have no handle so you can not get it to appear in
the frame.


I lifted this code example from Stephen Bullen's site. Specifically the
FormFun example.
http://www.oaltd.co.uk/Excel/Default.htm

in the cmdShow_Click event you need to get the userforms handle.

Dim lngfrm_hWnd As Long

' get handle to userform
lngfrm_hWnd = FindWindow("ThunderDFrame", 0&) 'XL2000+

and use it later, here

screenClasshWnd = FindWindow("screenClass", 0&)
SetParent screenClasshWnd, lngfrm_hWnd

Cheers
Andy

wrote:
Well, I got it working, sort of... It displays the show, small and the
size of the frame, but not in the frame... It displays at the top left
corner of the monitor. no errors though!

If you are interested in trying it:
http://www.rickycampbell.com/temp/TestPPShow.xls

I had to make a few mods, mostly because it is VBA and not VB. If
anyone has a suggestion...

On Apr 1, 2:34 pm, Steve Rindsberg wrote:

While this code looks closer to getting where I would like to go, I am
using VBA not VB, and cannot open the VB project file nor the form
enclosed in the VBA editor. I've tried to convert as much as possible
but I am stuck on what control is on the form to display the show in,
and if it is even possible to use this control in VBA.


You can open the form file (.FRM) in a text editor and extract the code that way.

The form seems only to have a couple of buttons, a frame and a label, so it doesn't
look like anything you couldn't replicate in VBA. Haven't tried it myself, so I
can't say whether you'd run into other issues though.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
============================================== ==




--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


All times are GMT +1. The time now is 05:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com