Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB Code generates error on another machine?

Hi,

I am currently using Excel 2003 here and have completed a pretty basic VB
code that gets data from one file, sorts, cuts & pastes to a master workbook
and then creates a new workbook from that data based on user input.

The problem I am having is that this little program works perfectly fine on
my Work PC and my PC at home but when someone else at work tries to run the
code it keeps crashing with a Subscript out of range error?

Why does this work on my PCs and not on my workmates who is going to use
this program???? Really frustrating! PLease can anyone help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VB Code generates error on another machine?

Include the extension in the filename:

workbooks("book1.xls").activate
not just
workbooks("book1").activate

(or windows(...)...)



Richard Smolik (Kordia) wrote:

Hi,

I am currently using Excel 2003 here and have completed a pretty basic VB
code that gets data from one file, sorts, cuts & pastes to a master workbook
and then creates a new workbook from that data based on user input.

The problem I am having is that this little program works perfectly fine on
my Work PC and my PC at home but when someone else at work tries to run the
code it keeps crashing with a Subscript out of range error?

Why does this work on my PCs and not on my workmates who is going to use
this program???? Really frustrating! PLease can anyone help?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VB Code generates error on another machine?

Thanks for your quick reply, I have checked your advice with my code but the
thing still doesn't work. COuld you please look at this and let me know what
might be the prob!

Sub COPYRAWDATA()

PROJYEAR = Worksheets("WORKING").Cells(9, 8)
PROJMONTH = Worksheets("WORKING").Cells(99, 1)
RAWFILENAME = "RAW DATA.XLS"
CHECKRAWFILE = Dir("G:\Admin\Timepro\Report AutoMATE\" & RAWFILENAME)

If CHECKRAWFILE = "" Then
MsgBox "RAW DATA FILE NOT FOUND"
Worksheets("WORKING").Cells(105, 6) = "NO"
Else
Worksheets("WORKING").Cells(105, 6) = "YES"

Workbooks.Open ("G:\Admin\Timepro\Report AutoMATE\" & RAWFILENAME)
MsgBox "CODE HAS REACHED HERE WITH NO ERRORS!"

'*************it gets here and error 9 *******************

Workbooks(RAWFILENAME).Sheets("Sheet1").Range("A1: J20000").Copy _
Destination:=Workbooks("Timepro Report AutoMATE").Sheets("RAW
DATA").Range("A1:J20000")

Workbooks("Timepro Report AutoMATE").Worksheets("WORKING").Activate
Workbooks(RAWFILENAME).Close

End If
End Sub

Thanks for your help.


"Dave Peterson" wrote:

Include the extension in the filename:

workbooks("book1.xls").activate
not just
workbooks("book1").activate

(or windows(...)...)



Richard Smolik (Kordia) wrote:

Hi,

I am currently using Excel 2003 here and have completed a pretty basic VB
code that gets data from one file, sorts, cuts & pastes to a master workbook
and then creates a new workbook from that data based on user input.

The problem I am having is that this little program works perfectly fine on
my Work PC and my PC at home but when someone else at work tries to run the
code it keeps crashing with a Subscript out of range error?

Why does this work on my PCs and not on my workmates who is going to use
this program???? Really frustrating! PLease can anyone help?


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default VB Code generates error on another machine?

The first thing I'd try is to include the .xls with both the "timepro report
automate.xls" references:

Workbooks(RAWFILENAME).Sheets("Sheet1").Range("A1: J20000").Copy _
Destination:=Workbooks("Timepro Report AutoMATE") _
.Sheets("RAW DATA").Range("A1:J20000")

And this one, too:
Workbooks("Timepro Report AutoMATE").Worksheets("WORKING").Activate
Workbooks(RAWFILENAME).Close





Richard Smolik (Kordia) wrote:

Thanks for your quick reply, I have checked your advice with my code but the
thing still doesn't work. COuld you please look at this and let me know what
might be the prob!

Sub COPYRAWDATA()

PROJYEAR = Worksheets("WORKING").Cells(9, 8)
PROJMONTH = Worksheets("WORKING").Cells(99, 1)
RAWFILENAME = "RAW DATA.XLS"
CHECKRAWFILE = Dir("G:\Admin\Timepro\Report AutoMATE\" & RAWFILENAME)

If CHECKRAWFILE = "" Then
MsgBox "RAW DATA FILE NOT FOUND"
Worksheets("WORKING").Cells(105, 6) = "NO"
Else
Worksheets("WORKING").Cells(105, 6) = "YES"

Workbooks.Open ("G:\Admin\Timepro\Report AutoMATE\" & RAWFILENAME)
MsgBox "CODE HAS REACHED HERE WITH NO ERRORS!"

'*************it gets here and error 9 *******************

Workbooks(RAWFILENAME).Sheets("Sheet1").Range("A1: J20000").Copy _
Destination:=Workbooks("Timepro Report AutoMATE").Sheets("RAW
DATA").Range("A1:J20000")

Workbooks("Timepro Report AutoMATE").Worksheets("WORKING").Activate
Workbooks(RAWFILENAME).Close

End If
End Sub

Thanks for your help.

"Dave Peterson" wrote:

Include the extension in the filename:

workbooks("book1.xls").activate
not just
workbooks("book1").activate

(or windows(...)...)



Richard Smolik (Kordia) wrote:

Hi,

I am currently using Excel 2003 here and have completed a pretty basic VB
code that gets data from one file, sorts, cuts & pastes to a master workbook
and then creates a new workbook from that data based on user input.

The problem I am having is that this little program works perfectly fine on
my Work PC and my PC at home but when someone else at work tries to run the
code it keeps crashing with a Subscript out of range error?

Why does this work on my PCs and not on my workmates who is going to use
this program???? Really frustrating! PLease can anyone help?


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VB Code generates error on another machine?

Thanks so very very much, I thought it was going to be something simple. You
are a life saver.

I guess I owe ya a beer or two.

"Dave Peterson" wrote:

The first thing I'd try is to include the .xls with both the "timepro report
automate.xls" references:

Workbooks(RAWFILENAME).Sheets("Sheet1").Range("A1: J20000").Copy _
Destination:=Workbooks("Timepro Report AutoMATE") _
.Sheets("RAW DATA").Range("A1:J20000")

And this one, too:
Workbooks("Timepro Report AutoMATE").Worksheets("WORKING").Activate
Workbooks(RAWFILENAME).Close





Richard Smolik (Kordia) wrote:

Thanks for your quick reply, I have checked your advice with my code but the
thing still doesn't work. COuld you please look at this and let me know what
might be the prob!

Sub COPYRAWDATA()

PROJYEAR = Worksheets("WORKING").Cells(9, 8)
PROJMONTH = Worksheets("WORKING").Cells(99, 1)
RAWFILENAME = "RAW DATA.XLS"
CHECKRAWFILE = Dir("G:\Admin\Timepro\Report AutoMATE\" & RAWFILENAME)

If CHECKRAWFILE = "" Then
MsgBox "RAW DATA FILE NOT FOUND"
Worksheets("WORKING").Cells(105, 6) = "NO"
Else
Worksheets("WORKING").Cells(105, 6) = "YES"

Workbooks.Open ("G:\Admin\Timepro\Report AutoMATE\" & RAWFILENAME)
MsgBox "CODE HAS REACHED HERE WITH NO ERRORS!"

'*************it gets here and error 9 *******************

Workbooks(RAWFILENAME).Sheets("Sheet1").Range("A1: J20000").Copy _
Destination:=Workbooks("Timepro Report AutoMATE").Sheets("RAW
DATA").Range("A1:J20000")

Workbooks("Timepro Report AutoMATE").Worksheets("WORKING").Activate
Workbooks(RAWFILENAME).Close

End If
End Sub

Thanks for your help.

"Dave Peterson" wrote:

Include the extension in the filename:

workbooks("book1.xls").activate
not just
workbooks("book1").activate

(or windows(...)...)



Richard Smolik (Kordia) wrote:

Hi,

I am currently using Excel 2003 here and have completed a pretty basic VB
code that gets data from one file, sorts, cuts & pastes to a master workbook
and then creates a new workbook from that data based on user input.

The problem I am having is that this little program works perfectly fine on
my Work PC and my PC at home but when someone else at work tries to run the
code it keeps crashing with a Subscript out of range error?

Why does this work on my PCs and not on my workmates who is going to use
this program???? Really frustrating! PLease can anyone help?

--

Dave Peterson


--

Dave Peterson



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code error; machine dependent SJC Excel Worksheet Functions 4 February 1st 06 04:31 PM
Working application - Now generates error Madiya Excel Programming 4 May 24th 05 12:18 PM
setting ThrottleInterval generates Run-Time error Marc Deveaux[_2_] Excel Programming 0 July 7th 04 04:56 PM
Find generates error message James Houston Excel Programming 3 April 28th 04 07:55 AM
Copy generates an automation error. Richard[_24_] Excel Programming 1 January 16th 04 12:37 PM


All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"