From: JoeF on 4 Aug 2010 19:14 Is there anyone that can recommend a solution to 'fix' an old VB application? It's a report card program that uses a Word template and fills in the word document from this .exe file created in VB. I have no idea how to debug as I am not the one who programmed it nor do I know antything more than beginner basic. It appears to be a very simple program and the folder consists of a few .bas files, .frx, and .frm files. I downloaded Visual Studio Pro to debug the .exe file, but I don't know where to begin. Problem: The program asks you to open the word document(Which it does), but when you click the tabs with the form, it tells me the document is not open. I attempted to look at the code, and I think the error is coming from around this area: ------------------------------------------------------------------------------------------------ 'Global CONNECTED As Boolean 'flag if word document is opened correctly Sub InitializeName() 'need err handler here On Error GoTo errorinit FirstName = wrdapp.ActiveDocument.FormFields("FFtxtFirstname").Result 'On Error GoTo errorinit LastName = wrdapp.ActiveDocument.FormFields("FFtxtLastName").Result errorinit: If Err.Number <> 0 Then '"Number " & Err.Number & vbCrLf & 'MsgBox Err.Description & vbCrLf & "file not opened correctly" Err.Clear MsgBox "There was an error reading the student's name" & vbCrLf & "Please make sure you have opened a Report Card Word File and the name has been entered correctly." FirstName = "" LastName = "" 'wrdapp.Application.Quit Exit Sub End If 'Exit Sub 'Resume Next '? End Sub Sub PageLength() Dim PageCount As Integer Dim response As Integer 'On Error GoTo errorhandler On Error Resume Next PageCount = wrdapp.ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages) If Err.Number <> 0 Then 'WordwasNotRunning = True Err.Clear ' Clear Err object in case error occurred. 'MsgBox "The Word document for your student " & FirstName & " is not open. " Exit Sub End If If PageCount <> 2 Then response = MsgBox("report is longer than two pages and will not print correctly. ", vbCritical, "REPORT TOO LONG!") End If 'errorhandler: 'MsgBox "Student file is not opened correctly" 'Exit Sub 'Resume End Sub 'Public Sub AddHScroll(List As ListBox) ' Dim i As Integer, intGreatestLen As Integer, lngGreatestWidth As Long ' 'Find Longest Text in Listbox 'For i = 0 To List.ListCount - 1 ' If Len(List.List(i)) > Len(List.List(intGreatestLen)) Then ' intGreatestLen = i ' End If ' Next i ' 'Get Twips ' lngGreatestWidth = List.Parent.TextWidth(List.List(intGreatestLen) + Space(1)) ' 'Space(1) is used to prevent the last Ch ' ' aracter from being cut off ' 'Convert to Pixels ' lngGreatestWidth = lngGreatestWidth \ Screen.TwipsPerPixelX ' 'Use api to add scrollbar ' SendMessage List.hWnd, LB_SETHORIZONTALEXTENT, lngGreatestWidth, 0 'End Sub Sub TestLength(Section As String) Dim LC As Integer 'set font size to 12 'On Error GoTo errorhandler On Error Resume Next wrdapp.Application.Windows(namedoc).Activate If Err.Number <> 0 Then 'WordwasNotRunning = True Err.Clear ' Clear Err object in case error occurred. MsgBox "The Word document for your student " & FirstName & " is not open. " & vbCrLf & "Please open using File - Open " frmTab.Caption = "Report Card Writer" & " - No student file open" FirstName = "" LastName = "" namedoc = "" frmTab.staRC.SimpleText = "No student's file is open. Open a student's file using File - Open or see Help for creating new student's file" Exit Sub ---------------------------------------------------------------------------------------------- ....because the message I keep getting is "The Word document for your student {studentname} is not open." I then try to open So for some reason, the .exe file thinks Word is not open. What's weird is that this program works on some XP machines with Office 2003 installed. Some other PC's running XP and Office 2003 don't work with the error descibed above. When I install on a Windows 7 and Office 2010, I get pretty much the same error. I really want to get this program to run. It must have to do with the link between Office and the .exe file. -JoeF
From: Kevin Provance on 4 Aug 2010 20:39 Top posted: What version of VB was the code originally written is, or what version are you attempting to load the code up in? Where are the location of the Word files you are attempting to open? Win7 has stricter rules about file IO that in XP...so before I can take a closer look at this, I would need to know some of these things. - Kev "JoeF" <JoeF(a)discussions.microsoft.com> wrote in message news:D4E7250B-BE1F-48C8-8D6A-32E9DADB86A3(a)microsoft.com... : Is there anyone that can recommend a solution to 'fix' an old VB application? : It's a report card program that uses a Word template and fills in the word : document from this .exe file created in VB. I have no idea how to debug as I : am not the one who programmed it nor do I know antything more than beginner : basic. It appears to be a very simple program and the folder consists of a : few .bas files, .frx, and .frm files. I downloaded Visual Studio Pro to debug : the .exe file, but I don't know where to begin. : : Problem: : : The program asks you to open the word document(Which it does), but when you : click the tabs with the form, it tells me the document is not open. I : attempted to look at the code, and I think the error is coming from around : this area: : ------------------------------------------------------------------------------------------------ : 'Global CONNECTED As Boolean 'flag if word document is opened correctly : Sub InitializeName() : 'need err handler here : On Error GoTo errorinit : : FirstName = wrdapp.ActiveDocument.FormFields("FFtxtFirstname").Result : 'On Error GoTo errorinit : LastName = wrdapp.ActiveDocument.FormFields("FFtxtLastName").Result : : errorinit: : If Err.Number <> 0 Then : '"Number " & Err.Number & vbCrLf & : 'MsgBox Err.Description & vbCrLf & "file not opened correctly" : Err.Clear : MsgBox "There was an error reading the student's name" & vbCrLf & "Please : make sure you have opened a Report Card Word File and the name has been : entered correctly." : FirstName = "" : LastName = "" : 'wrdapp.Application.Quit : Exit Sub : End If : 'Exit Sub : 'Resume Next '? : End Sub : Sub PageLength() : Dim PageCount As Integer : Dim response As Integer : 'On Error GoTo errorhandler : On Error Resume Next : PageCount = : wrdapp.ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages) : If Err.Number <> 0 Then : 'WordwasNotRunning = True : Err.Clear ' Clear Err object in case error occurred. : 'MsgBox "The Word document for your student " & FirstName & " is not : open. " : Exit Sub : End If : If PageCount <> 2 Then : response = MsgBox("report is longer than two pages and will not print : correctly. ", vbCritical, "REPORT TOO LONG!") : End If : 'errorhandler: : 'MsgBox "Student file is not opened correctly" : 'Exit Sub : 'Resume : : End Sub : 'Public Sub AddHScroll(List As ListBox) : ' Dim i As Integer, intGreatestLen As Integer, lngGreatestWidth As Long : ' 'Find Longest Text in Listbox : : 'For i = 0 To List.ListCount - 1 : ' If Len(List.List(i)) > Len(List.List(intGreatestLen)) Then : ' intGreatestLen = i : ' End If : ' Next i : ' 'Get Twips : ' lngGreatestWidth = List.Parent.TextWidth(List.List(intGreatestLen) + : Space(1)) : ' 'Space(1) is used to prevent the last Ch : ' ' aracter from being cut off : ' 'Convert to Pixels : ' lngGreatestWidth = lngGreatestWidth \ Screen.TwipsPerPixelX : ' 'Use api to add scrollbar : ' SendMessage List.hWnd, LB_SETHORIZONTALEXTENT, lngGreatestWidth, 0 : 'End Sub : : Sub TestLength(Section As String) : Dim LC As Integer : 'set font size to 12 : 'On Error GoTo errorhandler : : On Error Resume Next : wrdapp.Application.Windows(namedoc).Activate : : If Err.Number <> 0 Then : 'WordwasNotRunning = True : Err.Clear ' Clear Err object in case error occurred. : MsgBox "The Word document for your student " & FirstName & " is not : open. " & vbCrLf & "Please open using File - Open " : frmTab.Caption = "Report Card Writer" & " - No student file open" : FirstName = "" : LastName = "" : namedoc = "" : frmTab.staRC.SimpleText = "No student's file is open. Open a student's : file using File - Open or see Help for creating new student's file" : : Exit Sub : ---------------------------------------------------------------------------------------------- : : ...because the message I keep getting is "The Word document for your student : {studentname} is not open." I then try to open : : So for some reason, the .exe file thinks Word is not open. What's weird is : that this program works on some XP machines with Office 2003 installed. Some : other PC's running XP and Office 2003 don't work with the error descibed : above. When I install on a Windows 7 and Office 2010, I get pretty much the : same error. I really want to get this program to run. : : It must have to do with the link between Office and the .exe file. : : -JoeF
From: JoeF on 4 Aug 2010 23:10 Thanks for the reply...I believe it was VB 6. I'm using Notepad to look at the code currently. I downloaded Visual Studio Pro 2010 to attempt debugging the .exe file...but I'm so far removed from this stuff. I found a .pdm file that references Visual Studio\VB98... I found a .vbp file that shows: ================================================================================================================================== Type=Exe Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\WINDOWS\System32\stdole2.tlb#OLE Automation Reference=*\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#..\..\..\..\..\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL#Microsoft Office 8.0 Object Library Reference=*\G{00020905-0000-0000-C000-000000000046}#8.0#409#..\..\..\..\..\Program Files\Microsoft Office\Office10\MSWORD.OLB#Microsoft Word 8.0 Object Library Form=frmEngCognitive.frm Reference=*\G{00025E01-0000-0000-C000-000000000046}#5.0#0#..\..\..\..\..\Program Files\Common Files\Microsoft Shared\DAO\dao360.dll#Microsoft DAO 3.6 Object Library Module=Module1; Report Card Module.bas Form=frmEngLanguage.frm Reference=*\G{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0#..\..\..\..\..\WINDOWS\System32\FM20.DLL#Microsoft Forms 2.0 Object Library Form=frmEngSocial.frm Form=frmSpanCognitive2.frm Form=frmSpanLanguage.frm Form=frmPT.frm Form=frmOT.frm Form=frmAbout.frm Designer=frmEditTextTeachers.frm Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX Reference=*\G{3D5C6BF0-69A3-11D0-B393-00A0C9055D8E}#1.0#0#..\..\..\..\..\Program Files\Common Files\designer\MSDERUN.DLL#Microsoft Data Environment Instance 1.0 (SP4) Reference=*\G{00000205-0000-0010-8000-00AA006D2EA4}#2.5#0#..\..\..\..\..\Program Files\Common Files\system\ado\msado25.tlb#Microsoft ActiveX Data Objects 2.5 Library Form=frmTab.frm Module=Modulept; ModulePT.bas Designer=frmEngSelfHelp.frm Designer=frmEngFM.frm Designer=frmSpanFM.frm Designer=frmSpanSelfHelp.frm Designer=frmSpanSocial.frm Form=frmSplash.frm Form=frmHelp.frm Form=frmSpeech5Ps.frm Module=ModuleSpeech; ModuleSpeech.bas Module=ModuleOT; ModuleOT.bas Form=frmSpeechMainEnglish.frm Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX Module=ModuleTeacherSection; ModuleTeacherSection.bas Form=frmCounselingEng.frm Module=ModuleCounseling; ModuleCounseling.bas Class=comdlg; comdlg.cls Startup="Sub Main" HelpFile="" Title="report card" Command32="" Name="ReportCard" HelpContextID="0" CompatibleMode="0" MajorVer=1 MinorVer=0 RevisionVer=0 AutoIncrementVer=0 ServerSupportFiles=0 VersionCompanyName="" CompilationType=0 OptimizationType=0 FavorPentiumPro(tm)=0 CodeViewDebugInfo=0 NoAliasing=0 BoundsCheck=0 OverflowCheck=0 FlPointCheck=0 FDIVCheck=0 UnroundedFP=0 StartMode=0 Unattended=0 Retained=0 ThreadPerObject=0 MaxNumberOfThreads=1 DebugStartupOption=0 [MS Transaction Server] AutoRefresh=1 ============================================== "Kevin Provance" wrote: > Top posted: > > What version of VB was the code originally written is, or what version are > you attempting to load the code up in? > > Where are the location of the Word files you are attempting to open? > > Win7 has stricter rules about file IO that in XP...so before I can take a > closer look at this, I would need to know some of these things. > > - Kev > > > "JoeF" <JoeF(a)discussions.microsoft.com> wrote in message > news:D4E7250B-BE1F-48C8-8D6A-32E9DADB86A3(a)microsoft.com... > : Is there anyone that can recommend a solution to 'fix' an old VB > application? > : It's a report card program that uses a Word template and fills in the word > : document from this .exe file created in VB. I have no idea how to debug as > I > : am not the one who programmed it nor do I know antything more than > beginner > : basic. It appears to be a very simple program and the folder consists of a > : few .bas files, .frx, and .frm files. I downloaded Visual Studio Pro to > debug > : the .exe file, but I don't know where to begin. > : > : Problem: > : > : The program asks you to open the word document(Which it does), but when > you > : click the tabs with the form, it tells me the document is not open. I > : attempted to look at the code, and I think the error is coming from around > : this area: > : ------------------------------------------------------------------------------------------------ > : 'Global CONNECTED As Boolean 'flag if word document is opened correctly > : Sub InitializeName() > : 'need err handler here > : On Error GoTo errorinit > : > : FirstName = wrdapp.ActiveDocument.FormFields("FFtxtFirstname").Result > : 'On Error GoTo errorinit > : LastName = wrdapp.ActiveDocument.FormFields("FFtxtLastName").Result > : > : errorinit: > : If Err.Number <> 0 Then > : '"Number " & Err.Number & vbCrLf & > : 'MsgBox Err.Description & vbCrLf & "file not opened correctly" > : Err.Clear > : MsgBox "There was an error reading the student's name" & vbCrLf & "Please > : make sure you have opened a Report Card Word File and the name has been > : entered correctly." > : FirstName = "" > : LastName = "" > : 'wrdapp.Application.Quit > : Exit Sub > : End If > : 'Exit Sub > : 'Resume Next '? > : End Sub > : Sub PageLength() > : Dim PageCount As Integer > : Dim response As Integer > : 'On Error GoTo errorhandler > : On Error Resume Next > : PageCount = > : wrdapp.ActiveDocument.ComputeStatistics(Statistic:=wdStatisticPages) > : If Err.Number <> 0 Then > : 'WordwasNotRunning = True > : Err.Clear ' Clear Err object in case error occurred. > : 'MsgBox "The Word document for your student " & FirstName & " is not > : open. " > : Exit Sub > : End If > : If PageCount <> 2 Then > : response = MsgBox("report is longer than two pages and will not print > : correctly. ", vbCritical, "REPORT TOO LONG!") > : End If > : 'errorhandler: > : 'MsgBox "Student file is not opened correctly" > : 'Exit Sub > : 'Resume > : > : End Sub > : 'Public Sub AddHScroll(List As ListBox) > : ' Dim i As Integer, intGreatestLen As Integer, lngGreatestWidth As Long > : ' 'Find Longest Text in Listbox > : > : 'For i = 0 To List.ListCount - 1 > : ' If Len(List.List(i)) > Len(List.List(intGreatestLen)) Then > : ' intGreatestLen = i > : ' End If > : ' Next i > : ' 'Get Twips > : ' lngGreatestWidth = List.Parent.TextWidth(List.List(intGreatestLen) + > : Space(1)) > : ' 'Space(1) is used to prevent the last Ch > : ' ' aracter from being cut off > : ' 'Convert to Pixels > : ' lngGreatestWidth = lngGreatestWidth \ Screen.TwipsPerPixelX > : ' 'Use api to add scrollbar > : ' SendMessage List.hWnd, LB_SETHORIZONTALEXTENT, lngGreatestWidth, 0 > : 'End Sub > : > : Sub TestLength(Section As String) > : Dim LC As Integer > : 'set font size to 12 > : 'On Error GoTo errorhandler > : > : On Error Resume Next > : wrdapp.Application.Windows(namedoc).Activate > : > : If Err.Number <> 0 Then > : 'WordwasNotRunning = True > : Err.Clear ' Clear Err object in case error occurred. > : MsgBox "The Word document for your student " & FirstName & " is not > : open. " & vbCrLf & "Please open using File - Open " > : frmTab.Caption = "Report Card Writer" & " - No student file open" > : FirstName = "" > : LastName = "" > : namedoc = "" > : frmTab.staRC.SimpleText = "No student's file is open. Open a student's > : file using File - Open or see Help for creating new student's file" > : > : Exit Sub > : ---------------------------------------------------------------------------------------------- > : > : ...because the message I keep getting is "The Word document for your > student > : {studentname} is not open." I then try to open > : > : So for some reason, the .exe file thinks Word is not open. What's weird is > : that this program works on some XP machines with Office 2003 installed. > Some > : other PC's running XP and Office 2003 don't work with the error descibed > : above. When I install on a Windows 7 and Office 2010, I get pretty much > the > : same error. I really want to get this program to run. > : > : It must have to do with the link between Office and the .exe file. > : > : -JoeF > > . >
From: Kevin Provance on 5 Aug 2010 02:20 "JoeF" <JoeF(a)discussions.microsoft.com> wrote in message news:2EE6324D-E0BB-4E9A-8EAB-DDDBDE2802DA(a)microsoft.com... : Thanks for the reply...I believe it was VB 6. I'm using Notepad to look at : the code currently. I downloaded Visual Studio Pro 2010 to attempt debugging : the .exe file...but I'm so far removed from this stuff. NO!!!! STOP!!!! Code written in VB6 will not compile or even work in VS 2010. And even if you make it work, you'll have a several hundred megabyte runtime issue you don't want to deal with, especially if you are dealing with multiple machines all with varying OSs. Do you have VB 5 or 6 to work with? I am going to do my best to help save this project for you...but be aware we have an ongoing (and mostly ugly) debate about VB6 and what MSFT calls VB.NET. They are not the same thing (and watch the amount of replies I get from this point forward telling me I am wrong and why .NET is the way of the future, blah, blah, blah. All opinions. The truth in your scenario is using VB.Net or VS 2010, you will have to rewrite your project from the ground up, if you choose that route. All the "upgrade wizards" in the world are still going to leave you with a significant amount of work based on what I've seen so far. There is no getting around that, especially if you are a novice programmer. If you do not have access to VB 5 or 6, then I will work with you to fix this issue, as I suspect it requires a tweak or two to be compatible with Win 7. It will be quicker and easier than rewriting in a different language, even tho it bears the same name. And I certainly won't let the folks in this community who preach all things .NET push you into their web community. My email is kevin [dot] provance [at] tpasoft [dot] com. Send me an email so I can get some more detailed information from you, and help you avoid the flame war that's probably going to break out over the language debate in the next day or so. Even if it means running your project on my Win 7 box to find the error, we can fix this fairly quickly without a rewrite. Write me and let me know! - Kevin
From: Dee Earley on 5 Aug 2010 03:26 On 05/08/2010 00:14, JoeF wrote: > Is there anyone that can recommend a solution to 'fix' an old VB application? > It's a report card program that uses a Word template and fills in the word > document from this .exe file created in VB. I have no idea how to debug as I > am not the one who programmed it nor do I know antything more than beginner > basic. It appears to be a very simple program and the folder consists of a > few .bas files, .frx, and .frm files. I downloaded Visual Studio Pro to debug > the .exe file, but I don't know where to begin. It's probably better to ask this in a Word programming group or forum. While most of us have the experience and can help with generic VB6, your problem seems to be specific to the use of Word. -- Dee Earley (dee.earley(a)icode.co.uk) i-Catcher Development Team iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
|
Next
|
Last
Pages: 1 2 Prev: Adding a button to the Actions menu for Outlook 2003 for Contacts Next: Instantiation |