On 2002-02-17 18:07, Anonymous wrote:
On 2002-02-17 17:45, jgoulart wrote:
I would like to use vba code to make a new path and file name for an existing workbook. What syntax do I use to create the new folder when I'm trying to save the workbook?
I also would like to open a new workbook as "xfile.xls". How would I code that?
Thanks,
John
Hi John
Syntax to make a new directory;
From MSHELP:MkDir Statement Example
This example uses the MkDir statement to create a directory or folder. If the drive is not specified, the new directory or folder is created on the current drive.
MkDir "MYDIR" ' Make new directory or folder.
eg.MkDir "C:NewFolderXlfiles" OR
MkDir "NewFolderXlFiles" if C: is last Dir.
Then just reference the new dir to saveto;
eg Activeworkbook.save "C:NewFolderXlfilesxfile.xls"
Ivan