This website uses cookies to ensure you get the best experience on our website. By using our website you agree on the following Cookie Policy, Privacy Policy, and Terms Of Use
Example for SOLIDWORKS VSTA macro (C# or VB.NET) is copied from the SOLIDWORKS API Help documentation or from any source as a code. Number of compilation error are displayed:
MacroName.SolidWorksMacro doesn't contain a definition for 'SwApp'
The name 'Main' doesn't exist in the current context
VSTA macro is based on multiple connected files which must reside in the same namespace. When new macro is created the namespace might not be equal to the one
used in the example source code.
namespace MacroName.csproj
{
...
}
Resolution
Change the namespace in the SolidWorksMacro.cs file to match the default namespace
Join session by SOLIDWORKS and PDM API expret Artem Taturevych at 3DEXPERIENCE World 2025 on Feb 26 at 08:30 AM CST to explore 10 essential macros for automating drawings, assemblies, custom properties, and more