Determine type of OLE Control Object

Microsoft OFFICE

    Next

  • 1. Problem opening Excel workbook using Excel Interop
    Hi everyone, I'm writing a C# forms application to open an existing Excel workbook using the Excel Interop. Everything works fine. I can read and write fine. I do not save the workbook until the user close the C# application. The problem happens when my program is running and the user accidentally opens the same workbook with Excel. I get the error: Exception from HRESULT: 0x800401A8 at this line Range excelRange = worksheet.UsedRange; Is there a way to lock the workbook and not allow the user to open it with Excel when my program is running? Thanks
  • 2. Automate Microsoft Outlook 2003 using Visual C++ 2005
    Hello I can't work out how to use Visual C++ 2005 to automate Microsoft Outlook. I have seen many examples for doing this with Visual C++ 6.0 But when you use Visual C++ 2005 to import a typelib it now creates a large set of separate CPP files. And since Outlook relies on the Office object MSO.DLL there are issues there. So there are umpteen redefinition issues and problems with missing onjects, like Assistant object. In short, I am finding this a terrible nightmare. With VS 6 I was able to automate Word without a hitch because it created one C/CPP file from the OLB object and I was able to encompass the whole lot into a name space to avoid duplication. I might be trying to win a lossing battle here, but why can't I get this to work? Thank you. Andrew
  • 3. Remove signature event
    Hello, Does anybody know if there is an event I can listen to that enables me to catch the removal of an Signature?
  • 4. Office 2007 VBA Help Files - less useful than 2003?
    Good day, I am attempting to start using O2007 to update some macros I created in office 2003. However I am finding the help files in the Visual Basic for Applications Editor to be much less useful than the 2003 version. For example, there are no links from each page to the content's parents or properties or methods etc. Am I missing something? Thanks

Determine type of OLE Control Object

Postby Dale Fye » Sun, 23 Mar 2008 07:39:55 GMT

I'm trying to determine how I can identify the type (textbox, label, 
checkbox, listbox, combobox, ...) of an OLE Control Object that is on a 
slide, programatically.

I want to be able to click on a shape in design view, then run a macro that 
will tell me the type of a OLE Control object I have selected.  Then, if it 
is one that has a Text property, I want to display that.  If it has a 
caption property, I want to display that.  If it has a list of items 
(listbox or combo box), I would like to display the text associated with 
each of the items.

I've got some rudimentary code that handles the ones with captions and 
textboxes, but have not figured out how to iterate through the items in the 
list of a combo or listbox.  I know it has to be something like:

oShp.OLEFormat.Object.????????




Re: Determine type of OLE Control Object

Postby Steve Rindsberg » Sun, 23 Mar 2008 09:17:03 GMT

Manipulating Listbox and Combobox controls on slides and forms
 http://www.**--****.com/ 

Also, create a form and add the equivalent controls to it then use VBA help and 
the properties viewer to see the available properties and methods.  By 
appending them to .OLEFormat.Object you can work with OLE controls on a slide




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


Similar Threads:

1.Determine Forms Controls Type

Hi,
Is there a way to determine the type of a control of a custom form in vba ?
There is no type property and when I use the VB function TypeName it returns
"Control".
I would rather know what specific control object it is.


2.Determining control type

Can I determine what type of control I've landed on from the control
itself? 

e.g. can I have a function like the following?

Private Function GetControlType(ctrl as Control) as String
	if ctrl <is a textbox> Then
		GetControlType = "TextBox"
	ElseIf ctrl <is a checkbox> Then
		GetControlType = "CheckBox"
	....
		
End Sub

Is there a property that reliably exists in every control that tells
me its type?

thanks,
   gary

3.How to control menubar in a ole automation object such as ms word

Hi
    I dont know how to control the menubar in word from delphi. May somesone
else give me an advice?
Highly thanks
                                           C.T. CHEN


4.Control of an OLE object (ppt)

I'm building a 'survey' style template that's going out to a bunch of
different departments.
I'm stuck on a couple of things that I'm trying to do:

Problem 1
---------------
There's a big merged cell that responders should type text into.
However, they might not type in text, but they might want to past in a
ppt slide to answer the question.
How do I detect / collect this.
Specifically: I've got a 'progress bar' kind of arrangement, where if
they type something in an entry area, then that's treated as being
completed. This is picked up by a simple hidden page which has
formulas saying "=if(b10="","Incomplete","Complete"), which works
fine, unless they just answer question with an OLE PPT slide, in which
case how do I detect its presence?


Problem 2
---------------
The blank form will have some OLE Powerpoint slides built into it, so
that when a user presses on a button then the correct PPT slideshow
pops up. I've got that working nicely. There are 5 PPT objects, each
with some duplicated slides.

My client has asked me to change this to just one PPT presentation,
but when eg. you press 'button 1' only slides 1, 3 and 7 display, and
for button 2 a different combiniation of slides pops up. Is there any
way to do this?

And to top it off, the way I've got it set up at the moment, (using
the following line:

Sheets("Embed").Shapes("Object " & ObjectNumber).Select
    'ActiveSheet.Shapes("Object 5").Select
    Selection.Verb Verb:=xlPrimary

5.More control over moving and inserting OLE Objects via code

I want to allow users to move ole objects (images) on the worksheet by
dragging them with the mouse.  I can think of three ways to achieve
this (sort of).

1) Switch into design mode.  I'm not sure if there is code that will
allow me to do this though - anyone?
2) Trap the object MouseDown, Up and Move events and reposition the
object based on current mouse position.  My concern with this one is
that I will overload XL since the event will fire continuously and xl
will have to keep re-drawing the image.
3) Trap the object MouseDown event and create a new mouse pointer icon
(eg. a dashed box) then trap the  MouseUp event and reposition the
object to this position.  The problem with this one is that I really
need
to create the mouse icon on the fly to get the pointer in the right
position in the box image.  Any ideas
how I could do this?

Are my concerns in (2) justified?  Does anyone have any other
thoughts/ options/ concerns before I go too far
down one track.

This is also an issue for inserting the objects in the first place.  I
think for this option 3 would work
best but I don't know if there is a better approach that allows more
control over inserting objects - some
API calls perhaps?  Rather than going as far as inserting the object
(which .OLEObjects.Add does) I want to stop at the point where the
object is ready for the user to place it on the sheet.

I am using ole image objects rather than pictures or drawing objs
because they allow me to create a right
click menu and I can change the image within the same object to
reflect different user choices.  Also I can
"discourage" the user from copy/pasting the image.

Thanks a lot,
Andrew

6. Error Message - OLE object isn't an OLE object

7. Access 2000 - Insert OLE object programatically into a forms OLE object field



Return to Microsoft OFFICE

 

Who is online

Users browsing this forum: No registered users and 19 guest