Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I have been using the code below with no problem and have just moved it to a new module and now it wont work ?? Any suggestions welcome, i am not a programmer but a dabbler & just cannot find the problem. Sub ChkForFiles() ' Dim sLCS As String, LCS As String, sIhKTL As String, ihKtl As String Dim sKTL As String, KTL As String Dim blnIhKtl As Boolean, blnKtl As Boolean, blnLCS As Boolean, ihSh As Boolean Dim ktlSh As Boolean sLCS = "\\zapad01\sapinter\LCS\" & mylcs & ".xls" blnLCS = Len(Dir(sLCS)) sIhKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTLih & ".xls" blnIhKtl = Len(Dir(sIhKTL)) sKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTL & ".xls" blnKtl = Len(Dir(sKTL)) If IfSheetExistsTestIH("\\nv09002\tpdrive\Projects\Ge neral\50_Comparisons\KTL's\" & myKTLih & ".xls", "TOOL TRACKING") = True Then ihSh = True If IfSheetExistsTest("\\nv09002\tpdrive\Projects\Gene ral\50_Comparisons\KTL's\" & myKTL & ".xls", "TOOL TRACKING") = True Then ktlSh = True End If End If If blnLCS = True Then If blnIhKtl = True Then If ihSh = True Then If blnKtl = True Then If ktlSh = True Then GetLcsdate**** Goes to Problem if all true ??? Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Problem: With frmSelection.Label1 .Caption = "ONE OR MORE FILES/SHEETS NOT AVAILABLE:" & vbCrLf & vbCrLf & _ "LCS File Available : " & blnLCS & vbCrLf & _ "IH KTL File Available : " & blnIhKtl & vbCrLf & _ "Correct WorkSheet : " & ihSh & vbCrLf & _ "KTL File Available : " & blnKtl & vbCrLf & _ "Correct WorkSheet : " & ktlSh & vbCrLf & vbCrLf & _ "Click ""Reset"" to continue..." .Font.Name = "Arial" .Font.Size = 10 .Font.Bold = True .WordWrap = True .BackColor = RGB(255, 1, 52) End With End Sub -- Les |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You had a from in the old workbook that need to be copied into the new
workbook. If the form is a worksheet 1) open both the new and old workbook 2) right click the tab on the bottom of the old workbook form and select copy. then select the new workbook If the form is in VBA 1) Right click the form in the VBA Project window and select export. export to a file 2) Import the file into the new workbook VBA Project window "Les" wrote: Hi all, I have been using the code below with no problem and have just moved it to a new module and now it wont work ?? Any suggestions welcome, i am not a programmer but a dabbler & just cannot find the problem. Sub ChkForFiles() ' Dim sLCS As String, LCS As String, sIhKTL As String, ihKtl As String Dim sKTL As String, KTL As String Dim blnIhKtl As Boolean, blnKtl As Boolean, blnLCS As Boolean, ihSh As Boolean Dim ktlSh As Boolean sLCS = "\\zapad01\sapinter\LCS\" & mylcs & ".xls" blnLCS = Len(Dir(sLCS)) sIhKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTLih & ".xls" blnIhKtl = Len(Dir(sIhKTL)) sKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTL & ".xls" blnKtl = Len(Dir(sKTL)) If IfSheetExistsTestIH("\\nv09002\tpdrive\Projects\Ge neral\50_Comparisons\KTL's\" & myKTLih & ".xls", "TOOL TRACKING") = True Then ihSh = True If IfSheetExistsTest("\\nv09002\tpdrive\Projects\Gene ral\50_Comparisons\KTL's\" & myKTL & ".xls", "TOOL TRACKING") = True Then ktlSh = True End If End If If blnLCS = True Then If blnIhKtl = True Then If ihSh = True Then If blnKtl = True Then If ktlSh = True Then GetLcsdate**** Goes to Problem if all true ??? Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Problem: With frmSelection.Label1 .Caption = "ONE OR MORE FILES/SHEETS NOT AVAILABLE:" & vbCrLf & vbCrLf & _ "LCS File Available : " & blnLCS & vbCrLf & _ "IH KTL File Available : " & blnIhKtl & vbCrLf & _ "Correct WorkSheet : " & ihSh & vbCrLf & _ "KTL File Available : " & blnKtl & vbCrLf & _ "Correct WorkSheet : " & ktlSh & vbCrLf & vbCrLf & _ "Click ""Reset"" to continue..." .Font.Name = "Arial" .Font.Size = 10 .Font.Bold = True .WordWrap = True .BackColor = RGB(255, 1, 52) End With End Sub -- Les |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joel, it is within the same workbook, just a new module ?
-- Les "Joel" wrote: You had a from in the old workbook that need to be copied into the new workbook. If the form is a worksheet 1) open both the new and old workbook 2) right click the tab on the bottom of the old workbook form and select copy. then select the new workbook If the form is in VBA 1) Right click the form in the VBA Project window and select export. export to a file 2) Import the file into the new workbook VBA Project window "Les" wrote: Hi all, I have been using the code below with no problem and have just moved it to a new module and now it wont work ?? Any suggestions welcome, i am not a programmer but a dabbler & just cannot find the problem. Sub ChkForFiles() ' Dim sLCS As String, LCS As String, sIhKTL As String, ihKtl As String Dim sKTL As String, KTL As String Dim blnIhKtl As Boolean, blnKtl As Boolean, blnLCS As Boolean, ihSh As Boolean Dim ktlSh As Boolean sLCS = "\\zapad01\sapinter\LCS\" & mylcs & ".xls" blnLCS = Len(Dir(sLCS)) sIhKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTLih & ".xls" blnIhKtl = Len(Dir(sIhKTL)) sKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTL & ".xls" blnKtl = Len(Dir(sKTL)) If IfSheetExistsTestIH("\\nv09002\tpdrive\Projects\Ge neral\50_Comparisons\KTL's\" & myKTLih & ".xls", "TOOL TRACKING") = True Then ihSh = True If IfSheetExistsTest("\\nv09002\tpdrive\Projects\Gene ral\50_Comparisons\KTL's\" & myKTL & ".xls", "TOOL TRACKING") = True Then ktlSh = True End If End If If blnLCS = True Then If blnIhKtl = True Then If ihSh = True Then If blnKtl = True Then If ktlSh = True Then GetLcsdate**** Goes to Problem if all true ??? Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Problem: With frmSelection.Label1 .Caption = "ONE OR MORE FILES/SHEETS NOT AVAILABLE:" & vbCrLf & vbCrLf & _ "LCS File Available : " & blnLCS & vbCrLf & _ "IH KTL File Available : " & blnIhKtl & vbCrLf & _ "Correct WorkSheet : " & ihSh & vbCrLf & _ "KTL File Available : " & blnKtl & vbCrLf & _ "Correct WorkSheet : " & ktlSh & vbCrLf & vbCrLf & _ "Click ""Reset"" to continue..." .Font.Name = "Arial" .Font.Size = 10 .Font.Bold = True .WordWrap = True .BackColor = RGB(255, 1, 52) End With End Sub -- Les |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How is frmSelection defined? I don't think the problem is with the new
module, just frmSelection is not defined in the new module. "Les" wrote: Hi Joel, it is within the same workbook, just a new module ? -- Les "Joel" wrote: You had a from in the old workbook that need to be copied into the new workbook. If the form is a worksheet 1) open both the new and old workbook 2) right click the tab on the bottom of the old workbook form and select copy. then select the new workbook If the form is in VBA 1) Right click the form in the VBA Project window and select export. export to a file 2) Import the file into the new workbook VBA Project window "Les" wrote: Hi all, I have been using the code below with no problem and have just moved it to a new module and now it wont work ?? Any suggestions welcome, i am not a programmer but a dabbler & just cannot find the problem. Sub ChkForFiles() ' Dim sLCS As String, LCS As String, sIhKTL As String, ihKtl As String Dim sKTL As String, KTL As String Dim blnIhKtl As Boolean, blnKtl As Boolean, blnLCS As Boolean, ihSh As Boolean Dim ktlSh As Boolean sLCS = "\\zapad01\sapinter\LCS\" & mylcs & ".xls" blnLCS = Len(Dir(sLCS)) sIhKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTLih & ".xls" blnIhKtl = Len(Dir(sIhKTL)) sKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTL & ".xls" blnKtl = Len(Dir(sKTL)) If IfSheetExistsTestIH("\\nv09002\tpdrive\Projects\Ge neral\50_Comparisons\KTL's\" & myKTLih & ".xls", "TOOL TRACKING") = True Then ihSh = True If IfSheetExistsTest("\\nv09002\tpdrive\Projects\Gene ral\50_Comparisons\KTL's\" & myKTL & ".xls", "TOOL TRACKING") = True Then ktlSh = True End If End If If blnLCS = True Then If blnIhKtl = True Then If ihSh = True Then If blnKtl = True Then If ktlSh = True Then GetLcsdate**** Goes to Problem if all true ??? Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Problem: With frmSelection.Label1 .Caption = "ONE OR MORE FILES/SHEETS NOT AVAILABLE:" & vbCrLf & vbCrLf & _ "LCS File Available : " & blnLCS & vbCrLf & _ "IH KTL File Available : " & blnIhKtl & vbCrLf & _ "Correct WorkSheet : " & ihSh & vbCrLf & _ "KTL File Available : " & blnKtl & vbCrLf & _ "Correct WorkSheet : " & ktlSh & vbCrLf & vbCrLf & _ "Click ""Reset"" to continue..." .Font.Name = "Arial" .Font.Size = 10 .Font.Bold = True .WordWrap = True .BackColor = RGB(255, 1, 52) End With End Sub -- Les |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joel, the form is doing what i want it to, however if you see in my code
after the last if statement if all are true, it should branch to the Sub GetLcsdate, but it goes straight to Problem: ?? -- Les "Joel" wrote: How is frmSelection defined? I don't think the problem is with the new module, just frmSelection is not defined in the new module. "Les" wrote: Hi Joel, it is within the same workbook, just a new module ? -- Les "Joel" wrote: You had a from in the old workbook that need to be copied into the new workbook. If the form is a worksheet 1) open both the new and old workbook 2) right click the tab on the bottom of the old workbook form and select copy. then select the new workbook If the form is in VBA 1) Right click the form in the VBA Project window and select export. export to a file 2) Import the file into the new workbook VBA Project window "Les" wrote: Hi all, I have been using the code below with no problem and have just moved it to a new module and now it wont work ?? Any suggestions welcome, i am not a programmer but a dabbler & just cannot find the problem. Sub ChkForFiles() ' Dim sLCS As String, LCS As String, sIhKTL As String, ihKtl As String Dim sKTL As String, KTL As String Dim blnIhKtl As Boolean, blnKtl As Boolean, blnLCS As Boolean, ihSh As Boolean Dim ktlSh As Boolean sLCS = "\\zapad01\sapinter\LCS\" & mylcs & ".xls" blnLCS = Len(Dir(sLCS)) sIhKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTLih & ".xls" blnIhKtl = Len(Dir(sIhKTL)) sKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTL & ".xls" blnKtl = Len(Dir(sKTL)) If IfSheetExistsTestIH("\\nv09002\tpdrive\Projects\Ge neral\50_Comparisons\KTL's\" & myKTLih & ".xls", "TOOL TRACKING") = True Then ihSh = True If IfSheetExistsTest("\\nv09002\tpdrive\Projects\Gene ral\50_Comparisons\KTL's\" & myKTL & ".xls", "TOOL TRACKING") = True Then ktlSh = True End If End If If blnLCS = True Then If blnIhKtl = True Then If ihSh = True Then If blnKtl = True Then If ktlSh = True Then GetLcsdate**** Goes to Problem if all true ??? Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Problem: With frmSelection.Label1 .Caption = "ONE OR MORE FILES/SHEETS NOT AVAILABLE:" & vbCrLf & vbCrLf & _ "LCS File Available : " & blnLCS & vbCrLf & _ "IH KTL File Available : " & blnIhKtl & vbCrLf & _ "Correct WorkSheet : " & ihSh & vbCrLf & _ "KTL File Available : " & blnKtl & vbCrLf & _ "Correct WorkSheet : " & ktlSh & vbCrLf & vbCrLf & _ "Click ""Reset"" to continue..." .Font.Name = "Arial" .Font.Size = 10 .Font.Bold = True .WordWrap = True .BackColor = RGB(255, 1, 52) End With End Sub -- Les |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You better signgle step through the old module and new module to see the
difference in the two modules. Left click on first instruction in code. then press F8 to step through code. See which item(s) is false in old code. Compare with new code. I don't see any thing in the code you posted that is dependant on a NEW MODULE "Les" wrote: Hi Joel, the form is doing what i want it to, however if you see in my code after the last if statement if all are true, it should branch to the Sub GetLcsdate, but it goes straight to Problem: ?? -- Les "Joel" wrote: How is frmSelection defined? I don't think the problem is with the new module, just frmSelection is not defined in the new module. "Les" wrote: Hi Joel, it is within the same workbook, just a new module ? -- Les "Joel" wrote: You had a from in the old workbook that need to be copied into the new workbook. If the form is a worksheet 1) open both the new and old workbook 2) right click the tab on the bottom of the old workbook form and select copy. then select the new workbook If the form is in VBA 1) Right click the form in the VBA Project window and select export. export to a file 2) Import the file into the new workbook VBA Project window "Les" wrote: Hi all, I have been using the code below with no problem and have just moved it to a new module and now it wont work ?? Any suggestions welcome, i am not a programmer but a dabbler & just cannot find the problem. Sub ChkForFiles() ' Dim sLCS As String, LCS As String, sIhKTL As String, ihKtl As String Dim sKTL As String, KTL As String Dim blnIhKtl As Boolean, blnKtl As Boolean, blnLCS As Boolean, ihSh As Boolean Dim ktlSh As Boolean sLCS = "\\zapad01\sapinter\LCS\" & mylcs & ".xls" blnLCS = Len(Dir(sLCS)) sIhKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTLih & ".xls" blnIhKtl = Len(Dir(sIhKTL)) sKTL = "\\nv09002\tpdrive\Projects\General\50_Comparisons \KTL's\" & myKTL & ".xls" blnKtl = Len(Dir(sKTL)) If IfSheetExistsTestIH("\\nv09002\tpdrive\Projects\Ge neral\50_Comparisons\KTL's\" & myKTLih & ".xls", "TOOL TRACKING") = True Then ihSh = True If IfSheetExistsTest("\\nv09002\tpdrive\Projects\Gene ral\50_Comparisons\KTL's\" & myKTL & ".xls", "TOOL TRACKING") = True Then ktlSh = True End If End If If blnLCS = True Then If blnIhKtl = True Then If ihSh = True Then If blnKtl = True Then If ktlSh = True Then GetLcsdate**** Goes to Problem if all true ??? Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Else GoTo Problem End If Problem: With frmSelection.Label1 .Caption = "ONE OR MORE FILES/SHEETS NOT AVAILABLE:" & vbCrLf & vbCrLf & _ "LCS File Available : " & blnLCS & vbCrLf & _ "IH KTL File Available : " & blnIhKtl & vbCrLf & _ "Correct WorkSheet : " & ihSh & vbCrLf & _ "KTL File Available : " & blnKtl & vbCrLf & _ "Correct WorkSheet : " & ktlSh & vbCrLf & vbCrLf & _ "Click ""Reset"" to continue..." .Font.Name = "Arial" .Font.Size = 10 .Font.Bold = True .WordWrap = True .BackColor = RGB(255, 1, 52) End With End Sub -- Les |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help with code problem | Excel Programming | |||
Problem with code | Excel Programming | |||
Code Problem | Excel Programming | |||
VB Code Problem | Excel Discussion (Misc queries) | |||
Code problem | Excel Programming |