cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

VBA and Excel Not Working in MathCad 15

ptc-1259218
4-Participant

VBA and Excel Not Working in MathCad 15

In the attached MathCad worksheet is an embedded excel file that has VBA apps in it.  It takes data input and calculates to values C and C` or is suppose to.  The excel file "CANDCPRIME.XLS" on its own works fine but once it is inserted in to MathCad it is being blocked by Microsoft as "untrusted".  What do I have to do to make it run inside MathCad.  It use to just fine but I haven't used this MathCad worksheet for a few years because my work did not include a lot of steel design.  I am using a subscription to Microsoft Office 365 and have tried to modify all the security and "Trusted" stuff I could find to allow this to run.  And ass I mentioned above by itself runs perfectly. Put all the files attached in the same location.

Any help is appreciated.  Thank you,

John

ACCEPTED SOLUTION

Accepted Solutions

Hi,

In the time it takes to faff about with Windows and Microsoft 365(Excel) settings it is easier to simply replace the two macros with Mathcad functions for C and C' thus ellimination the need for the excel embedment altogether.  Just translation of the macros line by line.

 

Here are the two macros in the file provided and they have been checked as working as long as you don'[ enter 1 x 1 bolt groups.

Capture.JPG

 

View solution in original post

9 REPLIES 9

Hi,

In the time it takes to faff about with Windows and Microsoft 365(Excel) settings it is easier to simply replace the two macros with Mathcad functions for C and C' thus ellimination the need for the excel embedment altogether.  Just translation of the macros line by line.

 

Here are the two macros in the file provided and they have been checked as working as long as you don'[ enter 1 x 1 bolt groups.

Capture.JPG

 

Hi

See enclosed file

Works great.  Thanks tons!

In the routine for Bolt Coefficient C if the first input parameter (number of bolt rows) is 3 the routine gives a divide by zero error.  I can't find where it is occurring. Can you find it?

 

Thanks,

John

Hi John,

Found the missing piece.  When the bolt group has a bolt on the centroid "ri" for that bolt goes to zero.  So bolt groups like 3,1; 5,1; 3,3; with a central bolt fail.  In subsequent statements for Fx and Fy the formula have a divide by "ri" or zero for central bolt.  The original macro gets a round this with an "On Error Resume Next" statement that I ignored in original translation from VBA to Mathcad as I did not know what it was there for.  Now I do. 

 

Simple fix is to do the same thing in Mathcad

Capture.JPG

Encloses is a new BoltCoefficient() program you can copy and paste in your sheet after deleting the old one.

Cheers

Terry

Well I can't seem to get this to work either.  Same divide by error.  I even got the error when I opened the macro in MathCad 15 and I did not change a thing.  

Hope you have some other ideas?

John

Hi John,

 

Sorry uploaded wrong file my bad!

Capture.JPG

Hi John,

Not having a good day.

Enclosed v3 of file without my debug statement testing Mo = 0

 

Thank you so much Terry. Your bad day just made my day.

John

Announcements

Top Tags