From: Cor on
Did you already tried to run the the program as administrator? (right click
on it and then runas ....)

That is the most given error in other forums and newsgroups if it is
unrecognizable and windows 7

"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
Thank you for the replies...I have found the problem, but not sure how to
resolve...

When logged in to the computer as CLASSROOM, the report card program works.
When logged in as ADMIN, the report card program does not work.

- Within Windows 7, I installed something called XP MODE, which is a virtual
XP environment running inside of Windows 7.
- I installed Microsoft Office 2003 Professional inside of XP Mode.
- I installed the report card application using the instructions provided by
its creator.
o When attempting to run the report card application, it would fail with the
same errors I've explained in the past.
- After seeing that the program runs as CLASSROOM(Explained above), I
created a new user called CLASSROOM and logged in.
- I installed the report card application using the instructions provided by
its creator, this time under the CLASSROOM user.
o The report card application worked!!!!!!!!
- This was great news, because now I know the path to the files are hard
coded into the report card program. I now need to duplicate the CLASSROOM
user environment.

Here's the bad news…

- The default path to the documents folder changed when going from XP to
Vista/Windows 7.
o XP uses C:\Documents and Settings\username\Documents
o Vista/Windows 7 uses C:\Users\username\Documents
- The report card program has the XP path hard coded into the
executable(Reportcard.exe) application.
o Windows Vista and 7 use a junction point "Documents and Settings" which is
hidden. This is supposed to re-route old programs to the new location, but it
does not successfully do this with this report card app.

I tried to create the directory "Documents and Settings" on the C: drive
within Windows7, but can't.

Windows 7 uses the path C:\users\{username}\documents. Is there any way to
find these paths in the report card application and recompile with new paths?


"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.
>
> 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

"JoeF" <JoeF(a)discussions.microsoft.com> wrote in message
news:12BAA767-49DF-4F5B-B2F4-D5EF5DD48615(a)microsoft.com...
:
: Windows 7 uses the path C:\users\{username}\documents. Is there any way to
: find these paths in the report card application and recompile with new
paths?

Yes, but we need to be clear on something. If you are still using VS 2010
or any version of VB with dot net in the name, you'll need to ask in the
appropriate forum as this NG is for VB6 and lower.

http://vbnet.mvps.org/code/browse/csidl.htm

From: JoeF on
Yes...that's what makes it run....but the Word file can't remain open when
you attempt to run the report card app.

"Cor" wrote:

> Did you already tried to run the the program as administrator? (right click
> on it and then runas ....)
>
> That is the most given error in other forums and newsgroups if it is
> unrecognizable and windows 7
>
> "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
> >
> .
>