In the VBA MS Project code, change the width of the task list area in the Gantt chart - vba

When you open MS Project from another application, the Gantt chart chart closes most of the task list columns. How to change the width of the task list area in a Gantt chart in MS Project VBA code?

Use the setSplitBar method. i.e., ActiveProject.Application.SetSplitBar (15) will set the splitbar after 15 columns. Or it will fit the splitbar as far to the right of the screen as it can and still be visible.

Related

Hide and Open Columns in MS Project Gannt Chart using VBA

I have been searching the internet and testing, without much success, how to hide all task fields and then open targeted task fields in the Gannt Chart view of ms project. I am doing this because I want my script to automate the formatting, so the end-user does not have to pull up the fields that have interacted with the macro.
Does anyone have any recommendations?

Chart area in MS Graph chart on MS Access 2007 is sometimes blank

I have an MS Graph XY scatter chart on a form in an MS Access 2007 database. After opening the form the chart should show immediately, but the chart only sometimes shows the graph. It seems random. The reason why the visualization of the underlying data fails to show is that the Chart Area is empty, it doesn't even show the Plot Area and the Grid Lines in it. The query underlying the chart has data in two columns.
The toolbar for the chart object shows that the chart object is aware of this, because the in columns icon is highlighted. Even so the chart is not showing. I can make it visible by right-clicking the chart object and then selecting edit and then clicking the in rows icon in the toolbar, followed by clicking the in columns icon.
The MS Access Chart Object correctly tells the MS Graph chart object that the data are in two columns. Yet MS Graph sometimes needs to be explicitly informed of this by using the toolbar for the chart.
VBA might solve this problem by performing the routine for telling the MS Graph chart object that the data are in the columns.
On the On Open Event:
Private Sub Form_Open(Cancel As Integer)
Me.MyGraph.Object.Application.PlotBy = 1
Me.MyGraph.Object.Application.PlotBy = 2
End Sub
Commentary:
PlotBy = 1 means that the data is in the rows.
PlotBy = 2 means that the data is in the columns.
This works. I'll try further if the first line of code may be eliminated without compromising the result.
Edit (2020/11/28):
After eliminating the first line of code sometimes the chart will stay blank. So it is necessary to use both lines of code to tell MS Graph that the series are in the columns. This makes sense, because without running the code the MS Graph interface already shows that it knows that the series are in the columns, but even then it doesn't always act upon that knowledge, which is why the chart may remain empty in the first place.
Just telling MS Graph that the series are in the columns won't wake up MS Graph. So you have to first disrupt MS Graph's knowledge of where the series are (by telling it falsely that they are in the rows) and then to tell anew where they really are.
You need to add an Authorization header with a bearer access token and Identity documentation.
I noticed the Office 365 solutions, not the older Office tools. But i may be wrong as well. Being said that you can see the related tread that i came across.

Navigation Pane in Word 2016: VBA code to force collapsed view of headings

I am trying to write a VBA macro that runs when opening a .docx document. I want it to force the display of the Navigation Pane and then force all of the headings (any level) to display in collapsed mode. I am trying to get the code for the Collapse command using the macro recorder.
All I have when I record the macro is:
ActiveWindow.DocumentMap = True
Right-clicking on a heading in the Navigation Pane and collapsing does not record a code line. Is there a VBA method for this event?
I "solved" this requirement for myself by means of an AutoHotKey script, which just sends the necessary mouse click and subsequent key strokes. Not beautiful, but it works most of the times.
Kind regards, Hauke
As of this writing in 2019, this is not possible through VBA. It's been asked for from Microsoft for a long time.
As originally suggested in this Microsoft forum post, the quickest way to collapse all of the headings in the Navigation pane is to right-click one of the headings and click Collapse All. Obviously this is not an automated/macro-based solution, but it's all we have until Microsoft exposes the task panes through the VBA object model.

Adding gridlines to Excel VBA userforms

Is there a way to add gridlines and snap objects to gridlines in an Excel VBA Userform?
I am generating a UserForm in Excel VBA with numerous textboxes and labels. Aligning them, even with the auto-align and grouping tools is quite tedious and time-consuming. The process would be expedited if horizontal and vertical gridlines were available to snap the objects to (think AutoCAD). The default UserForm has grid dots but not lines and snapping must be manually enabled for each object; it is not a built-in default for all objects.
Turn on "Align Controls to Grid" in Tools => Options (dialog box) / General (tab) as shown below.

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.