Code to raise Directory request box

A

ANDYGM

I have a macro which saves the spreadsheet to a new directory (currently
the directory is specified within the macro). That's OK for me but I
want to distribute the spreadsheet to a wider audience and to make it
easy for them I'd like to include a piece of code which prompts them
for the directory to save to, just the same as when you do a 'Save As'
from the spreadsheet.

As some of the directory trees are quite complex, I can't ask them to
type the directory location.

Any ideas?
 
B

Bob Phillips

With Application.FileDialog(msoFileDialogFolderPicker)
.Show

MsgBox .SelectedItems(1)

End With

Look up FileDialog in the VBA help


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
A

ANDYGM

Thanks,

I was able to adapt your suggestion to fit what I want to do.

This is how it looks:

Dim Directory As Variant
'*****CHANGE NEW EXCEL SOURCE FILE PATH HERE******
With Application.FileDialog(msoFileDialogFolderPicker)
Show
Directory = .SelectedItems(1)
strNewSource = Directory & "\Report Builder v 1.2.xls"
End With
'*****CHANGE NEW EXCEL SOURCE FILE PATH HERE******
 

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