Académique Documents
Professionnel Documents
Culture Documents
Sub SendVarData().................................................................................................................................................................1 Sub TapData()........................................................................................................................................................................ 2 Sub SupdeSup(ShtNm As String, RetrieveorSentCode As nteger)........................................................................................! Sub S"Re#in$(TempD%t&i#e, Ne'D%t&i#e, Temp"ar&i#e, Ne'"ar&i#e As String)...................................................................( &un)tion *etDo)uments(ob+App, ob+Do)s)............................................................................................................................, &un)tion *etRevDo)uments(ob+App)...................................................................................................................................., &un)tion -inAng#e(.eader/D As Doub#e, Tube/D As Doub#e, Tube0entRad As Doub#e, 1 As Doub#e) As Doub#e.........2 &un)tion -in3(1 As Doub#e, Tube/D As Doub#e, Tube0entRad As Doub#e, -inAng#e As Doub#e) As Doub#e................2 &un)tion Comp(.eader/D As Doub#e, Tube/D As Doub#e, Tube0entRad As Doub#e, -inAng#e As Doub#e) As Doub#e. 2 Sub ReadVa#ue()....................................................................................................................................................................4 Sub 5riteSuppress(Ro'St As nteger, Co#St As nteger, Co#&i#ename As nteger, ShtName As String).............................11 Sub Create-ode#()...............................................................................................................................................................11
Sub SendVarData()
Dim ShtNm As String Dim MnfName As String Dim MnfSent As String Dim i As Integer Dim z As Integer Dim check As Integer Dim Check1 As Integer ShtNm = ActiveSheet.Name MnfName = Worksheets(ShtNm).Cells( ! ").#al$e" check = Msg%o&('Do (o$ )ant to r$n the *h(sical +arameters sen,ing )ith +arameterical checking-'! . v/0esNoCancel! '12S3 *arametric A$tomation') If check = " 4hen 3o4o 155 6or i = 1 4o 155 MnfSent = Worksheets('SentA').Cells(7! " 8 i).#al$e" If MnfName = MnfSent 4hen 0N = Msg%o&('Manifol, name ' 9 MnfName 9 ' is e&ists! ,o (o$ )ant to $+,ate-'! v/0esNo) If 0N = : 4hen 3o4o 155
If 0N = ; 4hen 3o4o "55 <lseIf MnfSent = '' 4hen Worksheets('SentA').Cells(7! " 8 i).#al$e" = MnfName "55 6or z = 1 4o 75 If check = : 4hen 3o4o 55 If CStr(Worksheets('SentA').Cells(7 8 z! " 8 i).#al$e") => . CStr(Worksheets(ShtNm).Cells(17 8 z! ").#al$e") 4hen Check1 = Msg%o&('C$rrent #al$e of ''' 9 . CStr(Worksheets('SentA').Cells(7 8 z! 1).#al$e") 9 '''? ' 9 . CStr(Worksheets('SentA').Cells(7 8 z! " 8 i).#al$e") 9 ' Ne) val$e? ' 9 . CStr(Worksheets(ShtNm).Cells(17 8 z! ").#al$e") 9 '@ *rocee, Change-'! . v/0esNoCancel! '12S3 *arametric A$tomation') If Check1 = : 4hen 3o4o A55 If Check1 = " 4hen 3o4o 155 <n, If 55 Worksheets('SentA').Cells(7 8 z! " 8 i).#al$e" = . Worksheets(ShtNm).Cells(17 8 z! ").#al$e" A55 Ne&t z <&it 6or <n, If Ne&t i 155 <n, S$/
Sub TapData()
B B 4a+ Data Macro B Macro create, 1CD11DEE /( Sigit Setia *ra/a)a B Com/ine )ith 4a+ Sheet to ta+ ,ata information from man( other <&cel files! Ski+ %lank B B Dim *Name As String Dim Check*roc! DirNm! 6lNm! ShNm! ArNm! FastSrc As String Dim Check*roc1! DirNm1! 6lNm1! ShNm1! ArNm1! FastSrc1 As String Dim Act6ile! ActSheet As String Dim ( As Integer Act6ile = ActiveWork/ook.Name ActSheet = ActiveSheet.Name Msg%o& (Act6ile)
Msg%o& (ActSheet) A++lication.Calc$lation = &lMan$al 6or ( = 1 4o 155 Check*roc = Worksheets(ActSheet).Cells(C! 1 8 () DirNm = Worksheets(ActSheet).Cells(;! 1 8 () 6lNm = Worksheets(ActSheet).Cells(:! 1 8 () ShNm = Worksheets(ActSheet).Cells(7! 1 8 () ArNm = Worksheets(ActSheet).Cells(E! 1 8 () FastSrc = Worksheets(ActSheet).Cells(15! 1 8 () If Check*roc = '' 4hen 3o4o If (DirNm 8 'G' 8 6lNm) = (DirNm1 8 'G' 8 6lNm1) 4hen 3o4o "" If DirNm1 = '' 4hen 3o4o ""1 Win,o)s(6lNm1).Activate 2ange('A%AA1').Select ActiveWork/ook.Close ""1 Work/ooks.H+en 6ileName?=(DirNm 8 'G' 8 6lNm)! I+,ateFinks?=5 Win,o)s.Arrange ArrangeSt(le?=&l#ertical ActiveWin,o).ScrollWork/ook4a/s Sheets?=1 ActiveWin,o).ScrollWork/ook4a/s Sheets?=1 "" Win,o)s(6lNm).Activate Worksheets(ShNm).Select 2ange(ArNm).Select Selection.Co+( Win,o)s(Act6ile).Activate Worksheets(ActSheet).Cells(1;! ( 8 1).Select Selection.*asteS+ecial *aste?=&l#al$es! H+eration?=&lNone! Ski+%lanks?= . 6alse! 4rans+ose?=6alse Worksheets(ActSheet).Cells(15! ( 8 1).Select Selection.Co+( ActiveCell.6orm$la21C1 = (DirNm 8 'G' 8 6lNm) 2ange('A1C').Select DirNm1 = DirNm 6lNm1 = 6lNm ShNm1 = ShNm ArNm1 = ArNm FastSrc1 = FastSrc Ne&t A++lication.Calc$lation = &lA$tomatic Win,o)s(6lNm1).Activate 2ange('A1C').Select ActiveWork/ook.Close 2ange('AA?%JC55').Select Selection.Col$mns.A$to6it ActiveWin,o).Win,o)State = &lMa&imize,
3
<lseIf 2etrieveorSentCo,e = 1 4hen B Check = Msg%o&('4his +rocess )ill changes s$+ress stat$s on (o$r mo,el. *rocee,-'! . B v/0esNoCancel! '12S3 *arametric A$tomation') If check = " 4hen 3o4o 155 *artN$m = Worksheets(ShtNm).Cells("! ).#al$e 6trN$m = Worksheets(ShtNm).Cells( ! ).#al$e 6or i = 1 4o *artN$m
*artNm = Worksheets(ShtNm).Cells(:! " 8 i).#al$e If CStr(*artNm) = '' Hr Worksheets(ShtNm).Cells(C! " 8 i).#al$e = 5 4hen 3o4o 155 Set o/MDoc = o/MDocs.H+en(*artNm) Set o/MMo,els = o/MDoc.Mo,els Set o/M6eat$res = o/MMo,els.Item(1).6eat$res o/MA++.Dela(Com+$te = 4r$e 6or z = " 4o 6trN$m S$+Co,e = Worksheets(ShtNm).Cells(7 8 z! " 8 i).#al$e" o/M6eat$res.Item(z).S$++ress = S$+Co,e Ne&t z 6or z = AA 4o AC S$+Co,e = Worksheets(ShtNm).Cells(z! " 8 i).#al$e" o/M6eat$res.Item(z).S$++ress = S$+Co,e Ne&t z o/MA++.Dela(Com+$te = 6alse o/MDoc.Save o/MDoc.Close 155 Ne&t i <lseIf 2etrieveorSentCo,e = 4hen
*artN$m = Worksheets(ShtNm).Cells("! ).#al$e 6trN$m = Worksheets(ShtNm).Cells( ! ).#al$e 6or i = 1 4o *artN$m *artNm = Worksheets(ShtNm).Cells(:! " 8 i).#al$e If CStr(*artNm) = '' Hr Worksheets(ShtNm).Cells(C! " 8 i).#al$e = 5 4hen 3o4o "55 Set o/MDoc = o/MDocs.H+en(*artNm) Set o/MMo,els = o/MDoc.Mo,els Set o/M6eat$res = o/MMo,els.Item(1).6eat$res o/MA++.Dela(Com+$te = 4r$e 6or z = 1 4o 6trN$m S$+Co,e = o/M6eat$res.Item(z).S$++ress If S$+Co,e = 4r$e 4hen S$+Co,e1 = 1 <lse S$+Co,e1 = 5 Worksheets(ShtNm).Cells(7 8 z! " 8 i).#al$e" = S$+Co,e1 Ne&t z 6or z = AA 4o AC S$+Co,e = o/M6eat$res.Item(z).S$++ress If S$+Co,e = 4r$e 4hen S$+Co,e1 = 1 <lse S$+Co,e1 = 5 Worksheets(ShtNm).Cells(z! " 8 i).#al$e" = S$+Co,e1 Ne&t z o/MA++.Dela(Com+$te = 6alse o/MDoc.Save
5
o/MDoc.Close "55 Ne&t i <lse <n, If BKKKKKKKKKKKKKKKKKKKKKKKKKKKKK Bo/MDoc.SaveAs 'C?GI++er1ea,erG1FArrangementGFArrgtDef.asm'! 6alse BKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK Set o/MA++ = Nothing Set o/MDocs = Nothing Set o/MDoc = Nothing <n, S$/
BKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
#unction %etRevDocuments(ob&App)
B4$rn on error han,ling. Hn <rror 2es$me Ne&t BAttem+t to connect to a r$nning instance of Soli, <,ge. Set o/MA++ = 3etH/Mect(! '2evisionManager.A++lication') If <rr 4hen BClear the error <rr.Clear BStart a ne) instance of Soli, <,ge. Set o/MA++ = CreateH/Mect('2evisionManager.A++lication') If <rr 4hen BDis+la( an error an, sto+ +rocessing. Msg%o& 'Co$l, not invoke Soli, <,ge'! v/HN <n, <n, If <n, If
#unction 'in,(+ As Double, Tube)D As Double, Tube*entRad As Double, 'inAngle As Double) As Double
If MinAngle = E5 4hen Min0 = 4$/eHD 8 4$/e%ent2a, <lse Min0 = z D #%A.Math.4an(MinAngle O .1A1CE D 175) . 8 (4$/e%ent2a, O (#%A.Math.4an(MinAngle O .1A1CE D ;5))) 8 4$/eHD <n, If <n, 6$nction
S$/ S*MinAngle(1ea,erHD As Do$/le! 4$/eHD As Do$/le! . 4$/e%ent2a, As Do$/le! z As Do$/le) Dim MinAngle As Do$/le Dim i As Fong Dim Com+ As Do$/le Dim AngCos1 As Do$/le Dim Angtan As Do$/le 6or i = 1 4o E55 MinAngle = (E55 K i) O 5.1 Angtan1 = #%A.Math.4an(MinAngle O .1A1CE D ;5) AngCos1 = #%A.Math.Sin(MinAngle O .1A1CE D 175) Com+ = 1ea,erHD D " 8 4$/eHD 8 (4$/e%ent2a, O (Angtan1)) O AngCos1 If Com+ > z 4hen MinAngle = (E51 K i) O 5.1 <&it 6or <n, If Ne&t i <n, S$/
Sub ReadValue()
Dim & As Integer Dim o/MA++ As H/Mect Dim o/MDoc As H/Mect Dim o/M#ars As H/Mect Dim o/M#ar(1 4o 1;5) As H/Mect Dim S1Name As String Dim i As Integer Dim z! l As Integer Dim *aramN$m! *artN$m As Integer Dim *aram(1 4o "55) As String Dim Check*aram As String Dim o/MDocs As H/Mect Dim tem+file As String Dim Check*art As Integer Dim check As Integer Dim convert As Integer check = Msg%o&('4he e&isting ,ata )ill /e re+lace, /(' 9 Chr(15) 9 'the ,ata from the e&isting mo,el. Contin$e-'! A! 'Warning PPP') If check = : 4hen <&it S$/ <n, If S1Name = ActiveSheet.Name *aramN$m = Worksheets(S1Name).Cells( ! ).#al$e *artN$m = Worksheets(S1Name).Cells("! ).#al$e Call 3etDoc$ments(o/MA++! o/MDocs)
6or & = 1 4o *artN$m Check*art = Worksheets(S1Name).Cells(C! " 8 &).#al$e If Check*art => '1' 4hen 3o4o 5 tem+file = Worksheets(S1Name).Cells(:! " 8 &).4e&t Set o/MDoc = o/MDocs.H+en(tem+file) Set o/M#ars = o/MDoc.#aria/les 6or z = 1 4o *aramN$m *aram(z) = Worksheets(S1Name).Cells(7 8 z! 1).4e&t Check*aram = Worksheets(S1Name).Cells(7 8 z! " 8 &).4e&t If Check*aram = 'L' Hr Check*aram = '&' Hr Check*aram = '' 4hen 3o4o "5 6or i = C 4o o/M#ars.Co$nt Set o/M#ar(i) = o/M#ars.Item(i) If o/M#ar(i).Name = *aram(z) 4hen convert = Worksheets(S1Name).Cells(7 8 z! ").#al$e Select Case convert Case 1 Worksheets(S1Name).Cells(7 8 z! " 8 &).#al$e" = o/M#ar(i).#al$e O 1555 Case " Worksheets(S1Name).Cells(7 8 z! " 8 &).#al$e" = o/M#ar(i).#al$e O (175 D .1A1CE":) Case <lse Worksheets(S1Name).Cells(7 8 z! " 8 &).#al$e" = o/M#ar(i).#al$e <n, Select 3o4o 15 <n, If Ne&t i 15 "5 Ne&t z 6or l = C 4o o/M#ars.Co$nt Set o/M#ar(i) = Nothing Ne&t l Set o/M#ars = Nothing o/MDoc.Close 5 Ne&t & Set o/MA++ = Nothing Set o/MDocs = Nothing Set o/MDoc = Nothing <n, S$/
10
Sub Create'odel()
Call WriteS$++ress(A! ActiveCell.Col$mn! ActiveCell.Col$mn! ActiveSheet.Name) <n, S$/
11