Open and save the part's journal from a drawing via C#

Hi all,

i'd like to open the journal file of  part from a drawing using C#.

Unfortunately the bool swViewStatus (SelectByID2) doesn't get true yet.

            SolidWorks.Interop.sldworks.View swView = default(SolidWorks.Interop.sldworks.View);

            swView = ActiveDrawing.GetFirstView();

            swView = swView.GetNextView();

            ModelDoc2 swModel = null;

            int nDocType = 0;

           

            if (swView != null)

            {

                String strModelName = swView.GetReferencedModelName();

                strModelName = strModelName.ToLower();

                if (strModelName.Contains(".sldprt"))

                {

                    nDocType = 1;

                    swModel = swApp.OpenDoc(strModelName, nDocType);

                    //swModel = swApp.OpenDoc6(strModelName, nDocType, (int)swOpenDocOptions_e.swOpenDocOptions_DontLoadHiddenComponents, "", 0, 0);

                }

                else

                {

                    nDocType = 2;

                    swModel = swApp.OpenDoc(strModelName, nDocType);

                    //swModel = swApp.OpenDoc6(strModelName, nDocType, (int)swOpenDocOptions_e.swOpenDocOptions_DontLoadHiddenComponents, "", 0, 0);

                }             

                             

                if (swModel != null)

                {

                 bool mViewStatus = swModel.Extension.SelectByID2("Journal.doc", "JOURNAL", 0, 0, 0, false, 0, null, 0);

                if (mViewStatus != true)

                {

                    mViewStatus = swModel.Extension.SelectByID2("Journal.doc (Leer)", "JOURNAL", 0, 0, 0, false, 0, null, 0);

                }

                if (mViewStatus)

                {

                    MessageBox.Show("Journal selected successfully");

                }

                }

                swModel.Save3(1, 1, 1);

            }

Any thoughts?

Thanks,

Chris

SolidworksApi macros