Cancel
Showing results for
Did you mean:

# function.bas

Valued Contributor

I would like to wright a funtion to use in the variable table in Solidedge. The Solidedge help files tells me I can use any text editor to wright a function as long as it is saved with a .bas file extention. For some reason I can not get it to work. I know .bas is some kind of a module file in VB6, but I only have VB.net. Would you have any ideal of what I may be doing wrong?

Posted by: Bob Reinkemeyer
Post date: 9/26/2005 4:08:20 AM

3 REPLIES

# RE: function.bas

Valued Contributor

Hi Bob,

Here is an example of something you could save as a bas file:

--- [EDITED: Thanks Jürgen] ---

Function MultiplyByTen(x As Double) As Double

MultiplyByTen= x * 10

End Function

Function DivideByTen(y As Double) As Double

DivideByTen = y / 10

End Function

You have to be careful when you set this up though. Follow these steps

1. Click on the Formula button

2. Select Visual Basic

3. Select your .bas file

4. Make sure you click on the appropriate function in the right hand list before clicking continue

5. Enter the argument, in the case above SE will ask for 'X' - if not you didn't read step 4

For step 5 you can enter a variable name, it doesn't have to be the actual value.

Hope this helps

Calum

Posted by: Calum McLellan
Post date: 9/29/2005 6:55:50 PM

# RE: function.bas

Valued Contributor

Hallo Calum,

I Think the code should be:

Function MultiplyByTen(x As Double) as Double

MultiplyByTen = x * 10

End Function

Function DivideByTen(y As Double) as Double

DivideByTen = y / 10

End Function

Jürgen

Posted by: Sachin Chougule
Post date: 9/30/2005 4:04:06 AM

# RE: function.bas

Valued Contributor

Jürgen,

Thanks for the correction, I was playing around with a function 'Test' and just quickly (too quickly) changed my code so there were two functions in the one file as I thought this would be a better example, I also forgot to add the return value - I've edited my post.

Where would we be without Intellisense...

Cheers

Calum

Posted by: Calum McLellan
Post date: 9/30/2005 9:12:48 PM