LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.powerpoint
external usenet poster
 
Posts: 2,489
Default 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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print Preview chart when chart is clicked request. joecrabtree Excel Programming 1 November 20th 07 02:00 PM
Interactive Pie chart in PowerPoint KG Charts and Charting in Excel 0 October 31st 06 04:46 PM
Modal Userform and Preview on Screen Jos Vens[_2_] Excel Programming 9 February 13th 06 09:50 PM
VBA to add a new chart into a PowerPoint presentation KJD Excel Programming 0 April 28th 04 03:12 PM
Use a UserForm to preview data Soniya Excel Programming 1 September 29th 03 12:15 PM


All times are GMT +1. The time now is 11:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"