Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Workbooks property

For the life of me I can not remember how to add a variable name to a file
path.
I have converted a file from text to xls and have saved it as myfile - date
in mmddyy

I have tried workbooks("myfile-"&date).close savechanges:=false.

but it does not like that.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Workbooks property

ActiveWorkbook.SaveAs FileName:=Workbooks(myFile & Format(Date, "mmddyy")

You can't add the date and us SaveChanges = False. It won't save anything.

"Rpettis31" wrote:

For the life of me I can not remember how to add a variable name to a file
path.
I have converted a file from text to xls and have saved it as myfile - date
in mmddyy

I have tried workbooks("myfile-"&date).close savechanges:=false.

but it does not like that.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Workbooks property

The file has already been saved. I am copying data from this file and
pasting it to another workbook. I am just looking to close the workbook now.

"JLGWhiz" wrote:

ActiveWorkbook.SaveAs FileName:=Workbooks(myFile & Format(Date, "mmddyy")

You can't add the date and us SaveChanges = False. It won't save anything.

"Rpettis31" wrote:

For the life of me I can not remember how to add a variable name to a file
path.
I have converted a file from text to xls and have saved it as myfile - date
in mmddyy

I have tried workbooks("myfile-"&date).close savechanges:=false.

but it does not like that.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Workbooks property

Either of these should work, depending on which workbook is active and which
contains the code that is running.


ActiveWorkbook.Close SaveChanges:=False
Workbooks(myFile & "-" & date) SaveChanges:=False

Using date as a variable in not a good idea since Date is a reserved word in
VB.
If you use it as a variable then it should be modified. i.e. myDate, edate,
etc.
Otherwise, it can create problems during runtime.

"Rpettis31" wrote:

The file has already been saved. I am copying data from this file and
pasting it to another workbook. I am just looking to close the workbook now.

"JLGWhiz" wrote:

ActiveWorkbook.SaveAs FileName:=Workbooks(myFile & Format(Date, "mmddyy")

You can't add the date and us SaveChanges = False. It won't save anything.

"Rpettis31" wrote:

For the life of me I can not remember how to add a variable name to a file
path.
I have converted a file from text to xls and have saved it as myfile - date
in mmddyy

I have tried workbooks("myfile-"&date).close savechanges:=false.

but it does not like that.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Workbooks property

If you still have problems, then try inserting this code snippet.

fName = ActiveWorkbook.Name
Workbooks(fName).Close SaveChanges:=False

"Rpettis31" wrote:

The file has already been saved. I am copying data from this file and
pasting it to another workbook. I am just looking to close the workbook now.

"JLGWhiz" wrote:

ActiveWorkbook.SaveAs FileName:=Workbooks(myFile & Format(Date, "mmddyy")

You can't add the date and us SaveChanges = False. It won't save anything.

"Rpettis31" wrote:

For the life of me I can not remember how to add a variable name to a file
path.
I have converted a file from text to xls and have saved it as myfile - date
in mmddyy

I have tried workbooks("myfile-"&date).close savechanges:=false.

but it does not like that.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Workbooks property

This worked, Thanks...Its always the easiest answer that seems to always
cause me the most issues.

Thanks alot.
Robert

"JLGWhiz" wrote:

If you still have problems, then try inserting this code snippet.

fName = ActiveWorkbook.Name
Workbooks(fName).Close SaveChanges:=False

"Rpettis31" wrote:

The file has already been saved. I am copying data from this file and
pasting it to another workbook. I am just looking to close the workbook now.

"JLGWhiz" wrote:

ActiveWorkbook.SaveAs FileName:=Workbooks(myFile & Format(Date, "mmddyy")

You can't add the date and us SaveChanges = False. It won't save anything.

"Rpettis31" wrote:

For the life of me I can not remember how to add a variable name to a file
path.
I have converted a file from text to xls and have saved it as myfile - date
in mmddyy

I have tried workbooks("myfile-"&date).close savechanges:=false.

but it does not like that.

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
Get Property value of class instance by passing string property name [email protected] Excel Programming 2 October 19th 07 05:47 PM
Runtime error 380 - Could not set the list property. Invalid property value. [email protected] Excel Programming 3 February 27th 07 06:35 AM
Runtime Error 380 – Could not set the list property. Invalid property value BernzG[_16_] Excel Programming 2 August 21st 05 10:10 PM
Unable to get the Open property of the Workbooks class Dean Hinson[_3_] Excel Programming 3 April 27th 05 12:34 PM
Runtime error 380: Could not set the List property. invalid property value of listbox jasgrand Excel Programming 0 October 6th 04 09:28 PM


All times are GMT +1. The time now is 09:35 PM.

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

About Us

"It's about Microsoft Excel"