我需要您的幫助才能正確使用CATIA。在CATIA中通過VBA使用excel公式通過
我目前的任務是爲模具創建一個「支撐」部分,其中必須插入螺絲帽(不管其長度)最大爲15mm。插入的螺釘長度取決於位於支撐部分上方的板。在Excel中,我已經創建了幾個公式來確定哪些螺絲釘必須被使用,但我不知道如何在VBA中使用Excel公式。有什麼辦法在VBA中使用Excel公式甚至電子表格?
'declaration of X as "Height of Plate 9"
Dim X As Integer
X = length1.Value
'declaration of Y as the result for the optimal length of the CapScrew to be used
Dim Y As Integer
Y = 0
'Formula for the length of the CapScrew to be used
If (designTable1.Configuration <= 15) = True Then
Y = X - 10 - 1 + 15
designTable2.Configuration = Y
Else
Y = X - 12 - 1 + 15
designTable2.Configuration = Y
End If
歡迎請使用你最喜歡的搜索引擎用「vba excel創建公式」。有很多指南和例子,[示例](https://msdn.microsoft.com/en-us/vba/excel-vba/articles/range-formula -property-excel),如果你在這期間碰到特定的編程問題,那麼回到這裏並描述它。 – miroxlav
有一個VBA命令使用Excel公式,但唉,我不知道該命令是什麼。谷歌會幫你找到命令。你也可以嘗試錄製一個宏,然後輸入一個公式,看看這個宏是怎麼產生的。 –
你的意思是你想在CATIA VBA代碼中使用excel公式嗎? –