Why doesn't this work on other computers?

S

SteveM

I created an application in Excel 2003 and adapted it to also work with
computers using Excel 2007 (all Windows XP). In use, a button calls the
RunBoth subroutine. Excel first tests that one or two windows are open in a
non-Office application, and if so, gets more user input and then sends
commands to interact with those windows to generate, paste into Excel,
process and compile information about each of a series of employees. Other
supervisors copy and paste the application to their computer or their network
site to use for the same purpose, possibly with a different name.

The programming works fine on my Excel 2003 computer and another's Excel
2007 computer, but on other Excel 2003 computers with supposedly the same
configuration it gives an error message "Invalid prodedure call or argument"
when it reaches the last command shown below (AppActivate ThisApp). This is
where the window of this Excel application is supposed to be re-activated in
order to send additional commands. Why would it choke here on those other
Excel 2003 computers?

Dim cnt
Dim IsIt As Boolean
Private Const AuxInt = "Agent AUX Interval" 'name of Avaya report
Private Const SumInt = "Agent Summary Interval" 'name of Avaya report
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long

Public Function ThisApp() As String
If Ver < 12 Then ThisApp = ActiveWorkbook.Name
If Ver = 12 Then ThisApp = ActiveWorkbook.Name & " [Compatibility Mode]"
End Function

Public Function Ver() As Integer
Ver = Val(Application.Version)
End Function

Sub IsItOpen(OtherApp As String)
IsIt = True
On Error GoTo NotOpen
AppActivate OtherApp
SendKeys "%(rr)", True
DoEvents
Do While FindWindow(vbNullString, OtherApp) = 0
DoEvents
Loop
SendKeys "%(rr)", True
DoEvents
Exit Sub
NotOpen:
What = OtherApp & " is probably not open." & vbNewLine & "If it is open,
click on it and click Run again." & vbNewLine & "If it isn't, open it and
click Run again."
MsgBox What, vbOKOnly
IsIt = False
End Sub

Sub RunBoth()
IsItOpen AuxInt
If Not IsIt Then: Exit Sub
AppActivate ThisApp
...........etc
 
K

Kevin Smith

hello,

I would at your reference library's. reason being if you have links to Excel
11 or Office 11 etc when using 2003, when you open the same spreadsheet in
2007 the references are changes to Excel 12 etc. Then when you open again you
get that error message because Excel 2003 does not understand the reference
to Excel 12.
 
S

SteveM

First thing I looked at > The same top four references are showing on both my
2003 computer where it does work and another 2003 computer where it doesn't
work. Since each person is copying the read-only file and renaming it to
their own location, including the person using 2007, there shouldn't be the
problem you describe.

Any other ideas?

Kevin Smith said:
hello,

I would at your reference library's. reason being if you have links to Excel
11 or Office 11 etc when using 2003, when you open the same spreadsheet in
2007 the references are changes to Excel 12 etc. Then when you open again you
get that error message because Excel 2003 does not understand the reference
to Excel 12.
--
Kevin Smith :blush:)


SteveM said:
I created an application in Excel 2003 and adapted it to also work with
computers using Excel 2007 (all Windows XP). In use, a button calls the
RunBoth subroutine. Excel first tests that one or two windows are open in a
non-Office application, and if so, gets more user input and then sends
commands to interact with those windows to generate, paste into Excel,
process and compile information about each of a series of employees. Other
supervisors copy and paste the application to their computer or their network
site to use for the same purpose, possibly with a different name.

The programming works fine on my Excel 2003 computer and another's Excel
2007 computer, but on other Excel 2003 computers with supposedly the same
configuration it gives an error message "Invalid prodedure call or argument"
when it reaches the last command shown below (AppActivate ThisApp). This is
where the window of this Excel application is supposed to be re-activated in
order to send additional commands. Why would it choke here on those other
Excel 2003 computers?

Dim cnt
Dim IsIt As Boolean
Private Const AuxInt = "Agent AUX Interval" 'name of Avaya report
Private Const SumInt = "Agent Summary Interval" 'name of Avaya report
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal
lpClassName As String, ByVal lpWindowName As String) As Long

Public Function ThisApp() As String
If Ver < 12 Then ThisApp = ActiveWorkbook.Name
If Ver = 12 Then ThisApp = ActiveWorkbook.Name & " [Compatibility Mode]"
End Function

Public Function Ver() As Integer
Ver = Val(Application.Version)
End Function

Sub IsItOpen(OtherApp As String)
IsIt = True
On Error GoTo NotOpen
AppActivate OtherApp
SendKeys "%(rr)", True
DoEvents
Do While FindWindow(vbNullString, OtherApp) = 0
DoEvents
Loop
SendKeys "%(rr)", True
DoEvents
Exit Sub
NotOpen:
What = OtherApp & " is probably not open." & vbNewLine & "If it is open,
click on it and click Run again." & vbNewLine & "If it isn't, open it and
click Run again."
MsgBox What, vbOKOnly
IsIt = False
End Sub

Sub RunBoth()
IsItOpen AuxInt
If Not IsIt Then: Exit Sub
AppActivate ThisApp
...........etc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top