ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   NEED HELP! Macro didn't survive XP! (https://www.excelbanter.com/excel-programming/296790-need-help-macro-didnt-survive-xp.html)

Ed[_18_]

NEED HELP! Macro didn't survive XP!
 
My workbook, which is published on the network, worked fine when saved from
Win/XL2000. I've been "improved" to XP. Yesterday was my first
distribution since the change. I did not change *any* code in the workbook.
I got bit by the first "It won't work" today - of course, it's saved as an
XP version and won't open on 2000 machines. So I did a SaveAs Microsoft
Excel 97-2002 & 5.0/95 Workbook, and it opened okay on a 2000 machine.

NOW, though, a code in the workbook won't work. It has always worked fine
(for about a year now). And the XP version works fine on my machine. The
code (copied below) threw up a "Can't find project or library" error,
highlighted at Cell in For Each Cell in rng..... A check of the references
showed MISSING: Word 10.0 Object Library!! Errors on Cell, and missing a
WORD library?!?

Can anyone help me?

Ed




Ken Wright

NEED HELP! Macro didn't survive XP!
 
No reason a 2000 piece of code wouldn't work on XP. No reason in general why
code from XP wouldn't work on 2000, other than the odd function or new command.
File format has been the same since 97 and remains unchanged up to and including
2003. The missing reference is obviously a problem, but you say you have errors
in the cell as well. You have omitted your code which makes things real hard,
so post your code and you'll no doubt be flooded with helpful advice :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"Ed" wrote in message
...
My workbook, which is published on the network, worked fine when saved from
Win/XL2000. I've been "improved" to XP. Yesterday was my first
distribution since the change. I did not change *any* code in the workbook.
I got bit by the first "It won't work" today - of course, it's saved as an
XP version and won't open on 2000 machines. So I did a SaveAs Microsoft
Excel 97-2002 & 5.0/95 Workbook, and it opened okay on a 2000 machine.

NOW, though, a code in the workbook won't work. It has always worked fine
(for about a year now). And the XP version works fine on my machine. The
code (copied below) threw up a "Can't find project or library" error,
highlighted at Cell in For Each Cell in rng..... A check of the references
showed MISSING: Word 10.0 Object Library!! Errors on Cell, and missing a
WORD library?!?

Can anyone help me?

Ed







---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.668 / Virus Database: 430 - Release Date: 24/04/2004



Den

NEED HELP! Macro didn't survive XP!
 
I distribute excel based solutions from an XP machine to other machines on
our network also. What I have found is that the other machines need to have
current patches and updates for their particular OS version and then they
work fine. Also some references in the VBA code has to be done at run time
rather than at development time, so you have to change a little bit of
coding to do run time references. So 1) get patches and updates, especial
for Office from Windows update site for all the machines you will distribute
to. 2). Change your code to do run time references instead of development
time references.


You should then be ok.
Dennis

"Ed" wrote in message
...
My workbook, which is published on the network, worked fine when saved

from
Win/XL2000. I've been "improved" to XP. Yesterday was my first
distribution since the change. I did not change *any* code in the

workbook.
I got bit by the first "It won't work" today - of course, it's saved as an
XP version and won't open on 2000 machines. So I did a SaveAs Microsoft
Excel 97-2002 & 5.0/95 Workbook, and it opened okay on a 2000 machine.

NOW, though, a code in the workbook won't work. It has always worked fine
(for about a year now). And the XP version works fine on my machine. The
code (copied below) threw up a "Can't find project or library" error,
highlighted at Cell in For Each Cell in rng..... A check of the

references
showed MISSING: Word 10.0 Object Library!! Errors on Cell, and missing a
WORD library?!?

Can anyone help me?

Ed






Ed[_18_]

NEED HELP! Macro didn't survive XP!
 
"Ed" wrote in message
...
My workbook, which is published on the network, worked fine when saved

from
Win/XL2000. I've been "improved" to XP. Yesterday was my first
distribution since the change. I did not change *any* code in the

workbook.
I got bit by the first "It won't work" today - of course, it's saved as an
XP version and won't open on 2000 machines. So I did a SaveAs Microsoft
Excel 97-2002 & 5.0/95 Workbook, and it opened okay on a 2000 machine.


First, grateful thanks and sincere apologies to those who looked in to help,
but found NO CODE! Sorry - frustration warps the brain! Thankfully, the
first glitch was easily solved. Typically, the second is not!

The workbook is stored in a folder on the network with almost 13,000 TADR
Inquiry Results (TIR) reports as Word docs. These are identified by a
unique number on Sheet1. The code below *USED TO* find the folder
containing the workbook and TIRs, grab the number from Sheet1, and open the
right Word doc. On my XP machine it's fine. On a Win/XL2000 machine, it
errors. References show MISSING Word 10.0 library and Word 9.0 library not
checked. When I unchecked the missing one and checked the 9.0 library, it
ran but locked up on WD.Documents.Open doc.

Any help is greatly appreciated.

Ed

Sub FindTIR()

Dim WD As Object
Dim doc As String
Dim Fname As String
Dim Fpath As String

' Get file path
Fpath = ThisWorkbook.Path

' Check if ActiveCell is in Col C
Sheets("Sheet1").Activate
If ActiveCell.Column = 3 Then

' Get TIR number from list page
Fname = ActiveCell.Text

' Open TIR
doc = Fpath & "\" & Fname & ".doc"
Set WD = CreateObject("Word.Application")
WD.Documents.Open doc
WD.Visible = True

Else
MsgBox "Please select a TIR number in Column C using a single mouse
click."

End If

End Sub



Jon Peltier[_7_]

NEED HELP! Macro didn't survive XP!
 
You have to remove the reference to Word 10, and run the macro as late
bound. Since you already are declaring variables as objects, and
creating a Word app without a version number, the only thing left is to
uncheck the reference to Word 10 in your app.

You have a reference to Word 10 in the file, but the other computer has
only Word 9. So you get "Compile Error. Can't find project or library."
Office is smart enough to change references from an older version to a
newer one, but not the other way.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Ed wrote:

"Ed" wrote in message
...

My workbook, which is published on the network, worked fine when saved


from

Win/XL2000. I've been "improved" to XP. Yesterday was my first
distribution since the change. I did not change *any* code in the


workbook.

I got bit by the first "It won't work" today - of course, it's saved as an
XP version and won't open on 2000 machines. So I did a SaveAs Microsoft
Excel 97-2002 & 5.0/95 Workbook, and it opened okay on a 2000 machine.



First, grateful thanks and sincere apologies to those who looked in to help,
but found NO CODE! Sorry - frustration warps the brain! Thankfully, the
first glitch was easily solved. Typically, the second is not!

The workbook is stored in a folder on the network with almost 13,000 TADR
Inquiry Results (TIR) reports as Word docs. These are identified by a
unique number on Sheet1. The code below *USED TO* find the folder
containing the workbook and TIRs, grab the number from Sheet1, and open the
right Word doc. On my XP machine it's fine. On a Win/XL2000 machine, it
errors. References show MISSING Word 10.0 library and Word 9.0 library not
checked. When I unchecked the missing one and checked the 9.0 library, it
ran but locked up on WD.Documents.Open doc.

Any help is greatly appreciated.

Ed

Sub FindTIR()

Dim WD As Object
Dim doc As String
Dim Fname As String
Dim Fpath As String

' Get file path
Fpath = ThisWorkbook.Path

' Check if ActiveCell is in Col C
Sheets("Sheet1").Activate
If ActiveCell.Column = 3 Then

' Get TIR number from list page
Fname = ActiveCell.Text

' Open TIR
doc = Fpath & "\" & Fname & ".doc"
Set WD = CreateObject("Word.Application")
WD.Documents.Open doc
WD.Visible = True

Else
MsgBox "Please select a TIR number in Column C using a single mouse
click."

End If

End Sub





All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com