+ Reply to Thread
Results 1 to 3 of 3

Error in Filename when saving

Hybrid View

  1. #1
    Registered User
    Join Date
    06-10-2009
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    46

    Error in Filename when saving

    Hi,

    I have a problem with the following code

    CW = CLng(InputBox("Please enter the current week (1-53)", "week"))
        Dim Savepath
        Dim dat4
        Set dat4 = Application.FileDialog(msoFileDialogFolderPicker)
        With dat4
        .Title = "Select Savepath"
        .InitialFileName = "J:\c_public\_events this month"
                  If .Show = -1 Then
                     Savepath = .SelectedItems(1)
                 End If
        End With
        ActiveWorkbook.SaveAs Filename = Savepath & "\events_week" & CW & ".xls"
    The File is named "False.xls" in the correct folder. Does anyone know, how to get the name to be "events_week37.xls"?
    Last edited by RoyMakaay1985; 09-11-2009 at 09:07 AM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Error in Filename when saving

    Hi

    You need a colon after the Filename:

    ActiveWorkbook.SaveAs Filename:= Savepath & "\events_week" & CW & ".xls"
    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    06-10-2009
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    46

    Re: Error in Filename when saving

    Thanks, now it works. Oh well, its Friday... Time to go home :P

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1