+ Reply to Thread
Results 1 to 7 of 7

Capture "Save As" Pathname and Save another File.

  1. #1
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Capture "Save As" Pathname and Save another File.

    I have an excel workbook that uses a .bmp file [a picture]. The master excel file and the .bmp file are in the same directory on the network. The excel file is "Read-Only", so the user would open it, customize it and save it on their own computer or somewhere else on the network.

    They are only allowed to save it under "Save As". Once the user saves it, they would then be able to use their customized copy for future updates etc. The problem is that the .bmp file is missing from this new directory.

    Is there a way to automatically save a copy of the .bmp file under the Directory specified by the user, so it's always available when the Excel workbook is opened? Or is there a way to attach the .bmp file to the excel file, so they are always saved together?

    Hope someone can help me or point me in the right direction.

    Thanks,
    modytrane.
    Last edited by modytrane; 11-10-2009 at 04:13 PM. Reason: SOLVED

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Capture "Save As" Pathname and Save another File.

    How does the workbook 'use' the bitmap?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Capture "Save As" Pathname and Save another File.

    Andy,
    Thanks for responding to my msg.
    Here's the code that uses the .bmp file to insert in to the Word file.
    Everything works fine.
    The only problem is that when the user saves the excel workbook to a new location and the .bmp file isn't copied, excel VBA would be looking for it in the "ThisWorkbook.Path & "\title.bmp"".
    So, I wanted to find a way to automatically save that .bmp file in the new directory specified by the user.
    modytrane


    Please Login or Register  to view this content.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Capture "Save As" Pathname and Save another File.

    The trouble is you do not know the location of where the file is going to be saved if you try and code for it in the BeforeSave event.

    You could try testing for the file in the BeforeClose event. But in order to do that you need to know where to copy the bmp from. If you know where to copy the bmp from then you could do the copy within the code you posted.

  5. #5
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Capture "Save As" Pathname and Save another File.

    The ,bmp file is in the same directory as the Excel workbook, when the whole process first starts.

    In Excel VBA, doesn't the "ThisWorkbook.Path " know current path [Directory] where the Excel workbook came from? The .bmp file to be copied would be there.

    The .bmp file never gets modified in the process. Only the Excel file gets updates and it is saved in different locations.

    Is there a way to capture "ThisWorkbook.Path" and use it to pull .bmp from and save it under "BeforeClose event"?

    modytrane

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Capture "Save As" Pathname and Save another File.

    In Thisworkbook object.
    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    11-27-2007
    Location
    New Jersey, USA
    MS-Off Ver
    2013
    Posts
    1,669

    Re: Capture "Save As" Pathname and Save another File.

    Thanks Andy,
    Works Perfect.
    Modytrane

+ 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