0
Thanks

A few words of thanks would be greatly appreciated.

VBA - A button to save filename of a document to a cell



Issue


I need to create a button that saves a modified document as a number in a particular cell (e.g in A6).

Solution


Private Sub CommandButton1_Click() 
  '.xlsm or xls depending if you want to save the macros. 
  ActiveWorkbook.SaveAs Filename:="c:\archive\" & Cells(1, 6) & ".xlsm" 
  Cells(1, 5) = "Archived" 
  If Cells(1, 5) = "Archived" Then 
    CommandButton1.Visible = False 
  End If 
End Sub 

Thanks to f894009 for this tip.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Related

Published by . Latest update on by deri58.

This document, titled "VBA - A button to save filename of a document to a cell," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).

0 Comments