Here is a subroutine that will export the IDF data. Same kind of deal - you have to feed it the file paths for the two output files.
Sub create_idf_output(emn_output_path asstring, emp_output_path asstring)
Dim idf_out_engine As MGCPCBEngines.IDFExport
'here we create the engine object
idf_out_engine = CreateObject("MGCPCBEngines.IDFExport")
'now we tell the engine what pcb file to use
idf_out_engine.DesignFileName = pcbdoc.FullName
'we tell the engine where to put the output file
idf_out_engine.BoardOutputFile = emn_output_path`
'we tell the engine where to put the output library file
idf_out_engine.LibraryOutputFile = emp_output_path
idf_out_engine.UseBoardThicknessFromStackup = true
idf_out_engine.DefaultComponentHeight = 0
idf_out_engine.ExcludeCellRouteObstructs = False
idf_out_engine.ExportComponentPinAndViaDrilledHoles = True
'idf_out_engine.ExportSection(7) = true
idf_out_engine.ExportSection(5) = True
idf_out_engine.ExportSection(4) = True
idf_out_engine.ExportSection(6) = True
idf_out_engine.ExportSection(3) = True
'idf_out_engine.ExportSection(8) = True
Try
idf_out_engine.Go
Catch ex As Exception
msgbox("An Automation Pro License was not found. Just try again.", vbOKOnly)
ExitSub
EndTry
idf_out_engine = Nothing
EndSub
Take note - you can also use the Variant Manager to get a list of components that are not installed, if you use that. I also have a complete script that with several subroutines that demonstrate how to get all this information from the variant manager, then create the IDF files, then modify them so that downstream tools such as CircuitWorks (part of SolidWorks) can import them and the uninstalled parts will be correctly designated as unplaced. Posting all of that here would be a hassle, but if you send me your email through a message here I'll send it to you.