Solution Searcher
New Member
- Joined
- Oct 18, 2012
- Messages
- 4
Hi guys
I am writing excel macro to create a table for young's modulus of materials. Just briefly describing what is meant to be done, connecting a table with 175000 row (rows contains materials e.x. metals ... etc) with different ID's some times similar, temperatures and norms. What I am up to do is writing macro in excel to connect this table to a material server program and search for young's modulus depending on temp. and ID of material.
I wrote a code which is working as I want but for some materials there is no available young's Modulus for some temperatures and then I am receiving message from the material server program which is saying not available and I should then press OK but this will be hard since I am dealing with 175000 different material so can any one help me with a code which can prevent that.
So I am receiving message not from excel but from the material server program and I want a code which will choose automatically OK and then I don't need to press OK my self every time.
Again thanks a lot.
My code is as following:
some words may not be clear because it is German
Dim Material As New LMaterial
Public Sub main()
Dim Ra As Range
Dim id As Integer
Dim N As Integer
Dim Emod As Single
Dim Alpha As Single
Set Ra = ActiveSheet.Range("A1")
With Material
N = 1
Do
id = CInt(Ra.Offset(N, 0).Value)
.Temperatur = CInt(Ra.Offset(N, 14).Value)
If .Temperatur < 20 Then
.Temperatur = 20
End If
.Suchtext = Str$(id)
Call .SearchAndCheck
Emod = .EModul(False)
'the problem shows up some times at this point when I debug
Alpha = .Alpha(False)
If Emod > 0! Then
EmodH = .EModul(True)
Ra.Offset(N, 15).Value = EmodH
'expT = .a
End If
N = N + 1
Loop While id > 0
End With
End Sub
I am writing excel macro to create a table for young's modulus of materials. Just briefly describing what is meant to be done, connecting a table with 175000 row (rows contains materials e.x. metals ... etc) with different ID's some times similar, temperatures and norms. What I am up to do is writing macro in excel to connect this table to a material server program and search for young's modulus depending on temp. and ID of material.
I wrote a code which is working as I want but for some materials there is no available young's Modulus for some temperatures and then I am receiving message from the material server program which is saying not available and I should then press OK but this will be hard since I am dealing with 175000 different material so can any one help me with a code which can prevent that.
So I am receiving message not from excel but from the material server program and I want a code which will choose automatically OK and then I don't need to press OK my self every time.
Again thanks a lot.
My code is as following:
some words may not be clear because it is German
Dim Material As New LMaterial
Public Sub main()
Dim Ra As Range
Dim id As Integer
Dim N As Integer
Dim Emod As Single
Dim Alpha As Single
Set Ra = ActiveSheet.Range("A1")
With Material
N = 1
Do
id = CInt(Ra.Offset(N, 0).Value)
.Temperatur = CInt(Ra.Offset(N, 14).Value)
If .Temperatur < 20 Then
.Temperatur = 20
End If
.Suchtext = Str$(id)
Call .SearchAndCheck
Emod = .EModul(False)
'the problem shows up some times at this point when I debug
Alpha = .Alpha(False)
If Emod > 0! Then
EmodH = .EModul(True)
Ra.Offset(N, 15).Value = EmodH
'expT = .a
End If
N = N + 1
Loop While id > 0
End With
End Sub