Changing filename

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro that will take data from an existing spreadsheet and copy
certain sheets into a new workbook. It then pastes these sheets as values.

What I want to do is save this new workbook and base the file name on the
original workbook and then add the text "(Values)" after it. So something in
C:\My Documents\Review For Partner.xls would then become C:\My
Documents\Review For Partner (Values).xls

A sample of the code is shown below:

Sub Macro1()
NewBookName = ThisWorkbook.FullName & " (Values)"
End Sub

The problem is that the file is called C:\My Documents\Review For
Partner.xls (Values).xls

I can see this is because when I use ThisWorkbook.FullName it produces the
answer "C:\My Documents\Review For Partner.xls"

What can I do to remove this .xls?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top