Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I determine if it is a new file or an existing file?
How can I tell (via VBA code) if the workbook is a new workbook from a
template or an existing workbook? If it is a new workbook, I want to SaveAs and give it a name. If it is an existing file, I just want to save it. I already understand the SaveAs and Save methods. I just don't know how to check whether it is new or existing. Thanks for any help anyone can provide, Conan Kelly |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I determine if it is a new file or an existing file?
Hi Conan
A workbook that is not saved one time have no path so you can test it like this. Sub test() If ActiveWorkbook.Path = "" Then MsgBox "New workbook" Else MsgBox "Old workbook" End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Conan Kelly" <CTBarbarin at msn dot com wrote in message ... How can I tell (via VBA code) if the workbook is a new workbook from a template or an existing workbook? If it is a new workbook, I want to SaveAs and give it a name. If it is an existing file, I just want to save it. I already understand the SaveAs and Save methods. I just don't know how to check whether it is new or existing. Thanks for any help anyone can provide, Conan Kelly |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I determine if it is a new file or an existing file?
try this
sub checknew() if workbooks("namehere").path = "" then 'workbook is new else 'workbook is not new end if end sub -- When you lose your mind, you free your life. "Conan Kelly" wrote: How can I tell (via VBA code) if the workbook is a new workbook from a template or an existing workbook? If it is a new workbook, I want to SaveAs and give it a name. If it is an existing file, I just want to save it. I already understand the SaveAs and Save methods. I just don't know how to check whether it is new or existing. Thanks for any help anyone can provide, Conan Kelly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
import data from txt file to an existing excel file | Excel Discussion (Misc queries) | |||
Determine Excel file version with no file extension. | Excel Discussion (Misc queries) | |||
User replaces existing file with blank during file open | Excel Discussion (Misc queries) | |||
Importing text file, only option to edit existing file | Excel Discussion (Misc queries) | |||
can i save an existing .xls file as a .csv file using command line | Excel Discussion (Misc queries) |