Jump to content

Solidworks VBA - all variables are empty...


Hickoz_bro

Recommended Posts

Hi all,

 

Just started playing with Solidworks VBA for the first time, and I'm a bit miffed about this problem. After running this bit of code from the Solidworks Help. I've reached the break on 'End Sub' and the screenshot below shows what I'm getting. All variables are showing Value = 0, nothing or Empty...

 

Capture.png

 

I ran the code on a file that should have returned LOTS of values show up. I've also tried a few other bits of code, but I can't get anything to show up...

 

Am I doing something wrong?

Link to comment
Share on other sites

I don't have solidWorks so can't try it, although from the code there and my knowledge of VBA I don't see anything seriously wrong.

 

A test: In the first for statement put in an if statement to start a break when you know it will be running and see whether it works.

Link to comment
Share on other sites

Try putting a break point on this line:

 

Set   swFeature = swFeature.GetNextFeature

 

Then you should see variable values for each swFeature as you loop thro them. Try using the Step Into button to step thro your code and watch how the variable values change in the Local Pane.

 

Abreak point on END SUB will not return anything because you've looped thro until swFeature is nothing, hence the empty variables.

Link to comment
Share on other sites

Here is 2 more screenshots showing the most simple code, and what I'm seeing (or not seeing) in the locals window.

 

First is Solidworks, showing nothing in the locals window.

Capture2.PNG

 

Next is MSExcel showing everything in the locals window.

Capture1.PNG

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...