A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Excel VB 2000 not working in 2003



 
 
Thread Tools Display Modes
  #1  
Old March 21st, 2005, 06:47 PM
A Lost Soul
external usenet poster
 
Posts: n/a
Default Excel VB 2000 not working in 2003

I've seen a previous post, but could not apply it to my case.
A macro which works well in Excel 2000 is not working in 2003, which follows;

Sub SaveFile()
Sheets("Journal").Select
Range("E3").Select
Selection.End(xlDown).Select
Name = Selection
Sheets("Worksheet").Select
Sheets("Worksheet").Copy
ChDir "C:\CLAU\Accounting"
ActiveWorkbook.SaveAs FileName:=Name

ActiveWindow.Close
Range("E11").Select

End Sub

This may not be the most kosher method of saving a worksheet, but it used to
work. I am trying to automaticallys save a worksheet which is named according
to a cell name in the file. (Line 1 to line 3 are to land on the correct cell
which I want to use as my file name, which is a concatenate of several
seperate cells) Although this macro used to work well in 2003, it stops now
on Name = Selection (specifically on Name) and returns error "Compile Error:
can't find project or library". Shoud I Dim Name as something?
PLEASE HELP!
Thanks,

John Manship
Siemens COM Br.
(55-11) 3908-2989
  #2  
Old March 21st, 2005, 11:33 PM
Ed Ferrero
external usenet poster
 
Posts: n/a
Default

Hi Lost,

Name is a reserved keyword in Excel VBA. And, yes, it is a good idea to
declare variables.
Change to something like this;

Sub SaveFile()
Dim strName As String

strName = Sheets("Journal").Range("E3").End(xlDown).Value

Sheets("Worksheet").Copy
ChDir "C:\CLAU\Accounting"
ActiveWorkbook.SaveAs Filename:=strName

ActiveWindow.Close
Range("E11").Select

End Sub

Ed Ferrero


"A Lost Soul" A Lost wrote in message
...
I've seen a previous post, but could not apply it to my case.
A macro which works well in Excel 2000 is not working in 2003, which
follows;

Sub SaveFile()
Sheets("Journal").Select
Range("E3").Select
Selection.End(xlDown).Select
Name = Selection
Sheets("Worksheet").Select
Sheets("Worksheet").Copy
ChDir "C:\CLAU\Accounting"
ActiveWorkbook.SaveAs FileName:=Name

ActiveWindow.Close
Range("E11").Select

End Sub

This may not be the most kosher method of saving a worksheet, but it used
to
work. I am trying to automaticallys save a worksheet which is named
according
to a cell name in the file. (Line 1 to line 3 are to land on the correct
cell
which I want to use as my file name, which is a concatenate of several
seperate cells) Although this macro used to work well in 2003, it stops
now
on Name = Selection (specifically on Name) and returns error "Compile
Error:
can't find project or library". Shoud I Dim Name as something?
PLEASE HELP!
Thanks,

John Manship
Siemens COM Br.
(55-11) 3908-2989



  #3  
Old March 22nd, 2005, 01:21 PM
John
external usenet poster
 
Posts: n/a
Default

Thanks Ed, You made my day!! That did the trick. Thanks again for the help.
Best regards,

John Manship

"Ed Ferrero" wrote:

Hi Lost,

Name is a reserved keyword in Excel VBA. And, yes, it is a good idea to
declare variables.
Change to something like this;

Sub SaveFile()
Dim strName As String

strName = Sheets("Journal").Range("E3").End(xlDown).Value

Sheets("Worksheet").Copy
ChDir "C:\CLAU\Accounting"
ActiveWorkbook.SaveAs Filename:=strName

ActiveWindow.Close
Range("E11").Select

End Sub

Ed Ferrero


"A Lost Soul" A Lost wrote in message
...
I've seen a previous post, but could not apply it to my case.
A macro which works well in Excel 2000 is not working in 2003, which
follows;

Sub SaveFile()
Sheets("Journal").Select
Range("E3").Select
Selection.End(xlDown).Select
Name = Selection
Sheets("Worksheet").Select
Sheets("Worksheet").Copy
ChDir "C:\CLAU\Accounting"
ActiveWorkbook.SaveAs FileName:=Name

ActiveWindow.Close
Range("E11").Select

End Sub

This may not be the most kosher method of saving a worksheet, but it used
to
work. I am trying to automaticallys save a worksheet which is named
according
to a cell name in the file. (Line 1 to line 3 are to land on the correct
cell
which I want to use as my file name, which is a concatenate of several
seperate cells) Although this macro used to work well in 2003, it stops
now
on Name = Selection (specifically on Name) and returns error "Compile
Error:
can't find project or library". Shoud I Dim Name as something?
PLEASE HELP!
Thanks,

John Manship
Siemens COM Br.
(55-11) 3908-2989




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send Excel 2000 worksheets to Excel 2003? SecretarybyBarry General Discussion 2 February 21st, 2005 05:28 PM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk General Discussion 2 January 17th, 2005 08:07 PM
Mail Merge from Excel 2003 to Word 2003 not working properly Yusuf Mailmerge 1 August 19th, 2004 09:45 AM
Continual Error 1321 Trying to Install Office 2003 Chad Harris General Discussions 9 June 11th, 2004 08:19 AM


All times are GMT +1. The time now is 03:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.