Copy an excel file to new created folder

From: Kevin (anonymous_at_discussions.microsoft.com)
Date: 09/09/04


Date: Thu, 9 Sep 2004 05:54:01 -0700

Try the following:

 MkDir path

where path is a string. You can assemble the string on the
fly by concatenating the user input onto the rest of your
path statement as necessary.

Then create your file by using the SaveAs or SaveCopyAs
commands (check help). I save a copy of a workbook by
doing the following:

fileName = MyPath & SaveFileName & ".xls"

ActiveWorkbook.SaveCopyAs (fileName)

Where SaveFileName is a variable I use to assign a user
input value. fileName is also a variable that includes the
full path to the directory where the file will be saved.

Hope that helps!

Kevin
>-----Original Message-----
>Hello VB addicts!
>I programmed a macro to create folders on the main
directory(ex: S:
>directory)
>When a user enters a file number in excel, a batch of
folder will be
>created.
>For each file folder batch created, I will need to
include an excel
>file. How can I automate this procedure?
>Currently the excel file is saved on the S: directory.
>
>Thanks in advance for you help and continue to enjoy life!
>myrna
>
>
>
>*** Sent via Developersdex http://www.developersdex.com
***
>Don't just participate in USENET...get rewarded for it!
>.
>



Relevant Pages

  • Re: Syntax to Find Users File in MultiUser App
    ... Directory or a specific folder like "My Documents". ... If you're asking about the Excel typelib in particular, you're in luck, ... FindExecutable API function to get the full file name of Excel by passing ... ByVal lpDirectory As String, _ ...
    (microsoft.public.excel.programming)
  • Re: Send Word Data to Excel
    ... I can’t see anything in the folder. ... Dim vConnection As New ADODB.Connection ... Dim FileArrayAs String ... transfer the data from these Form Fields into an Excel spreadsheet? ...
    (microsoft.public.word.vba.general)
  • Re: Check if a folder has x files in it.
    ... I'd declare it as a string or pass cstrto the function. ... Dim FSO As Object ... Microsoft MVP - Excel, 10 Years ... not, a message box will display, prompting the user to check the folder ...
    (microsoft.public.excel.misc)
  • Re: The Ultimate Problem
    ... I assumed that the folder FILES was under the ... Dim TheFile As String ... What I need to do is run some excel code that will open ...
    (microsoft.public.excel.programming)
  • Re: VB6 and Windows Media Player
    ... within the My Music Folder. ... Private Declare Function ShellExecute Lib "shell32.dll" Alias ... "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal ... the folder Documents and Settings eg:- C:\Documents and Settings? ...
    (microsoft.public.vb.general.discussion)

Loading