I'm pretty new at VBA and I wrote this macro awhile back and now want to improve it slightly. It works great now but there is one caveat. My mirror plane name has to always be the same. I always want to mirror about the "Top plane" even if it's not named that. Here is my code below but basically it checks if it needs to make a mirror by looking for something in the file name and if it finds that it does the mirror but I'd like the select the plane without calling up it's name if it's different, or how do I get the planes name before this step?
Dim SearchString As String
Dim featureMgr As SldWorks.FeatureManager
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swApp.ActiveDoc Is Nothing Then
MsgBox "No Open Documents"
search = "-01"
'Original File Path
FilePath = swModel.GetPathName
MyPath = "X:\Ready For Release\"
'01 File Convert to step
PathNoExtension = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, ".") - 1) & ".step"
filename = Right(PathNoExtension, Len(PathNoExtension) - InStrRev(PathNoExtension, "\"))
'convert 02 file name
mFileName = Replace(filename, search, "-02")
'Full 02 file path
newpath = MyPath & mFileName
'Saves LH Model
swModel.Extension.SaveAs MyPath & filename, 0, 0, Nothing, fileerrors, filewarnings
'Checks File name to see if it needs to make a RH model
If InStr(filename, "-01") > 0 Then
'Select Mirror Plane
swModel.Extension.SelectByID2 "BL 0.00", "PLANE", 0, 0, 0, False, 0, Nothing, 0
'Save RH Part
swModel.Extension.SaveAs newpath, 0, 0, Nothing, fileerrors, filewarnings