Inserting VBA code with Excel

S

sowetoddid

This is the what I want to happen...

ActiveWorkbook.SaveAs Filename:=Range("B1").Value


The code will read the value in B1 and make that the saveas file name.



How do I do this??


Thank you
 
B

Bob Phillips

That code does do it. If you put it in a macro and assign that macro to a
toolbar button, you will have an 'on-demand' facility.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
B

Bernie Deitrick

sowetoddid,

Exactly the way that you wrote it, just wrap it in a subroutine:

Sub sowetoddidSave()
ActiveWorkbook.SaveAs Filename:=Range("B1").Value
End Sub

Run the macro manually, call it from a button, or call it from an
event. Lots of choices, but you need to say which....

HTH,
Bernie
MS Excel MVP
 
S

sowetoddid

Sorry to seem ignorant, but how do I make that a macro withou
physically recording it
 
S

sowetoddid

OK!!! Great! That worked. Now, how do I choose where it will be save
at on my computer??

Can it be saved some where besides "My Documents"?? That is where i
automatically goes.


Thank you, Thank you
 
B

Bernie Deitrick

sowetoddid,

Sub sowetoddidSave()
ActiveWorkbook.SaveAs Filename:="C:\Your desired Folder path name\" &
Range("B1").Value
End Sub
 
G

Gord Dibben

You have the code from Bernie to save to a drive and folder.

Note of caution here: I highly recommend you DO NOT save directly to your "a"
drive, which I assume is a floppy drive.

File corruption is quite commonplace when doing this.

Floppies and other removable media are for transporting and/or for backups of
copied files.

Save to and Open from your Hard Drive.

Gord Dibben Excel MVP
 

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

Top