PDM's Workflow transitions

I’m wondering how to change the document state via API/macro. Do you know any method to do it?

Take a look at the example file on their help page for a full example:
https://help.solidworks.com/2021/english/api/epdmapi/batch_change_states_of_files_example_csharp.htm

Here’s a small snippet as an example as well that checks to see if the transition exists before changing state:

/// Language: c#
/// Preconditions:
/// User has IEdmVault5 (_vault) pointer
/// User has EdmFile5 (pdmFile) pointer
/// User has EdmFolder5 (pdmFolder) pointer
/// User has a string (transitionName) that represents the name of the destination state
/// User has a boolean (showDialogWindow) that pops up the state change dialog when set to true
var _batchChanger = _vault.CreateUtility(EdmUtility.EdmUtil_BatchChangeState) as IEdmBatchChangeState5;
_batchChanger.AddFile(pdmFile.ID, pdmFolder.ID);
_batchChanger.GetAvailableTransitionList(out var ppoTransitions);

foreach (var ppoTransition in ppoTransitions)
{
	//System.Diagnostics.Debug.WriteLine("Available Transition: " + ppoTransition.moName);

	if (!string.Equals(ppoTransition.moName, transitionName,
					   StringComparison.CurrentCultureIgnoreCase)) continue;
	
	_batchChanger.CreateTree(ppoTransition.moName);

    var bRet = true;
	if (showDialogWindow)
	{
		bRet = _batchChanger.ShowDlg(0);
	}

	if (bRet)
	{
		_batchChanger.ChangeState(0);
	}

	break;
}
_batchChanger.GetAvailableTransitionList(out var ppoTransitions);

In VBA I’ve set as following (late binding):

Dim ppoTransitions() As Object

(...)

_batchChanger.GetAvailableTransitionList ppoTransitions

I get the incompatible type error on debugging.

If I set the PDM library reference (early binding) and declare that variable as EdmChangeStateTransitionInfo then it runs ok.

I’m following the instructions according to (last topic) https://www.codestack.net/solidworks-pdm-api/getting-started/macros/