Application.ObjectChangeIcon method in MS Project - vba

I read Edge MS documentation on the subject method and a couple of things are unclear or perhaps wrong. Supposedly the document was written or updated 01/18/22 so it should be applicable to Project 2019 Pro desktop.
1.The remarks section says, "The bitmap or drawing object must be displayed and selected" (Gantt Chart view). What exactly does that mean? I created a drawing object (polygon), placed it on the Gantt Chart and selected it. However, when I attempt to run Application.ObjectChangeIcon via the Immediate window, an error occurs saying, "The method is not available in this situation". What am I missing?
2.Further in the remarks section it talks about creating a new custom ribbon tab and group. Then it says to add the Object and Convert commands to the group. There is a Convert command but there is no "Object" command.
Project ribbon commands screen shot:
John

Related

How to Edit Custom (Server) Document Properties - Microsoft Word 2013 (VB Macros)

A Microsoft Word 2013 document at work has the Document Information Panel (DIP) displayed by default, with what is listed as "Document Properties - Server".
I'm trying to make a VB Macro that will involve editing these custom properties. However they don't seem to exist in ActiveDocument.CustomDocumentProperties, or ActiveDocument.BuiltInDocumentProperties. I know this because I ran through the list, displaying them one by one, as well as searching them by name.
The first property on the DIP called 'Title' showed up (in the latter list), but none of the other properties. It's worth noting that some are dropdowns, and one is a date with a calendar feature. I should also mention that I get a Run-time error near the end of the list of BuiltInDocumentProperties.
Is there another list where I can access these server properties, or some other issue that I'm overlooking? Any help would be appreciated.
I was able to find them. They are listed in ActiveDocument.ContentTypeProperties

Controls in designer are not shown on form

I have a panel contains many controls, the designer file has its code and I can not find them on the form and I can not see them on document outline window although when trying to add a new panel with same name I get an error saying 'The name wowPanel is already in use by another component.'
What can I do to resolve this issue?
I replaced my designer file with an old version then everything goes very well.
Look for all instances in your form code where you have the name/text wowPanel
REM out these lines temporarily
REM out any subroutines if you have event subroutines for the wowpanel
Next add the new wowPanel and Name it as so "wowPanel"
Now UN-REM (un-remark) all the code statements you REMmed out earlier.
That ought to do it.

VB2010: Viewing Object Structure for Learning/Visualization Purposes

I was wondering if there is a way to take an object in Visual Basic 2010 (Express, FWIW) and browse through its structure to visualize how the data inside is laid out.
For example, I have an object called "model" that is populated by a function that is a black box to me. Model is set by a "read" function that loads a DXF file from disk. The read function isn't very well-documented.
What I've discovered is that model.Entities ends up containing a list of different objects, all with different properties. I'd like to be able to simply browse this list of objects and view their associated properties and values at run-time, similar to how you can use Intellisense to view a list simply by typing "blah." and waiting for the pop-up to appear.
A tree view that you can pop open and closed would be excellent. Obviously this has to work during run-time rather than in the editor because the file hasn't been loaded if the program isn't running.
Is this something that's possible in Visual Basic 2010? Is it a built-in feature I can't find?
Thanks!
If a function returns an object, then that object has a class definition somewhere. Right-click the reference in VS and select "View in Object Browser" and you'll see the class layout with all properties and methods. You don't need to do this at run-time, either.
If you want to dig even deeper then you should check out Reflector.
EDIT
After reading your comments more, I usually do one of three things when I'm trying to do this:
Use the Autos and Locals window
Use the Immediate Window
Use "break-point and hover"
Use the Autos and Locals window
Set a breakpoint and check out the Autos and Locals windows. If you don't see them they're under the main menu at Debug, Windows. This allows you to walk a tree-view of your variables. Sometimes there can be a lot of stuff in here which I why I generally use one of the other two methods below.
Use the Immediate Window
The Immediate Window (IW) allows you to type in expressions and print out values. Its not a tree-view like you want but it allows you to hunt and peck at least. If you imagine the following short and simple code and you put a breakpoint on the second line:
Dim Names As New List(Of String)({"Alice", "Bob", "Chuck"})
Console.WriteLine(Names)
In the IW you could type:
?Names
And it would output:
Count = 3
(0): "Alice"
(1): "Bob"
(2): "Chuck"
The question mark symbol means "print". You can type almost any valid expression for print:
?Names(0)
"Alice"
?Names(0).Substring(0,1)
"A"
?Names(0).Contains("ice")
True
And as you're doing all of this you're getting IntelliSense about whatever is going on.
Use "break-point and hover"
I don't think this has a name beyond IntelliSense but once you've hit a breakpoint you can hover over any variable and inspect its current values. You'll get the occasionally warning that inspection will cause some processing but since you're debugging only this should be fine. Sometimes when I'm debugging a collection I'll create a variable specific to one item in the collection just to make this technique easier. I'll get rid of it once I'm done debugging but it really helps this process.
Is there another

Microsoft Chart Controls runtime chart

I am using microsoft chart controls in VB.net. The graph data currently comes from my database, but all the series and chart formats were made before runtime. I want to know how to make charts on runtime, being able to select the x axis from my dataset and multiple y columns from my dataset. Thanks
"Made before runtime" is very unclear, I'll assume you used the designer and changed properties in the Property grid window.
In the Solution Explorer window, click the "Show All Files" icon. That shows a node next to your form, open it and double-click the Designer.vb file. Scroll down to the InitializeComponent method, you'll see code that was generated by the designer to initialize the chart control.
Copy and paste this code into your own method. That gives you a major running start on the code you need to configure the chart yourself at runtime.

System.Threading.ThreadstateException

I'm developing an adding for office powerpoint application.
I'm trying to display a description of the object(Customized object) currently dropped on the powerpoint slide in design mode(Design mode of the powerpoint).
When i click on my addin the related object description will be displayed on a tabbed window as the first tabpage.
There is a button on the tab page, and when i click on it i need the description to get copied to windows clipboard.
I tried this using clipboardclass it throws the following exception,
System.Threading.ThreadstateException
{"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it."}
Code for clipboard:
Clipboard.Clear()
Clipboard.SetText(lblObjectID.Text)
I searched the net for a solution and got couple of answers like,
1. Put [STAThread] in the main function
2. Thread.CurrentThread.SetApartmentState(ApartmentState.STA) Immediately before your call to SetDataObject.
But I'm not sure where to put the 1st one and the 2nd option didn't work.
Can anyone help me please.
Thanks.
WinForms are STA by default. Are you creating another thread or using a BackgroundWorker? Run this code to determine what mode you're in:
MessageBox.Show(System.Threading.Thread.CurrentThread.GetApartmentState().ToString())
Edit:
But maybe you could also try using this command before calling the clipboard functions:
Application.OleRequired()