+ Reply to Thread
Results 1 to 9 of 9

Define name -variable- by saving as

  1. #1
    Registered User
    Join Date
    02-03-2010
    Location
    Holland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Define name -variable- by saving as

    Hi!

    I am looking for a solution to define a name by saving as.
    I think I'm almost there, but can't find the part where i can name it.

    In steps:
    1) Define the path and the name of the current file as string - to delete extension (=.csv)
    2) Save current file as current name with .xls in folder where is current file saved before.

    This is a part of my code - the part that is neccesary to see what I am doing:

    Please Login or Register  to view this content.
    The comment is in Dutch, but I think the code is readable...

    Is there someone who can help me out?

    Best regards,

    Brigitte
    Last edited by Brie; 02-16-2010 at 10:29 AM.

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Define name -variabel- by saving as

    Hi,

    For a start, have you simply tried
    ActiveWorkbook.SaveAs Filename:=myFilePath
    HTH

  3. #3
    Registered User
    Join Date
    02-03-2010
    Location
    Holland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Define name -variabel- by saving as

    Hi JeanRage,

    I just tried it.

    I used the first part of my code ('Naam van het ... ".csv", "")
    And then added your code.

    Excel then gives an error; it says that there is already existing such a file-name, because its trying to save a csv file... And it should be an xls file.

    Do you know how to change this?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Define name -variabel- by saving as

    Shouldn't it be:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  5. #5
    Registered User
    Join Date
    02-03-2010
    Location
    Holland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Define name -variabel- by saving as

    You're right romperstomper!

    This is working!

    But... It's only a small part of my code, How can I show the pop-up?
    For now it's saved at the right place with the right name, but i would like to accept it manually, if it's possible...

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Define name -variabel- by saving as

    Use myOriginalFileNameForSaving instead of myOriginalFileNameToXls in the SaveAs code then.

  7. #7
    Registered User
    Join Date
    02-03-2010
    Location
    Holland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Define name -variabel- by saving as

    I'm sorry, its better to write down what I'm doing. I used this:

    Please Login or Register  to view this content.
    This should lead to a pop-up, I thought, which is filled with filename.xls instead of "filename.csv"?

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,974

    Re: Define name -variabel- by saving as

    You are not specifying the InitialFileName argument:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-03-2010
    Location
    Holland
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Define name -variabel- by saving as

    Perfect! This is it!

    Fool that I am, I'm probably too many characters seen in recent times - just completely overlooked.

    Thnx!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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