Hi Kevin
The Browse for folder is giving you the opportunity to choose where you want
to save the file.
If your folder name in cell B1 does not begin with a backslash, then change
the line of code to be
strName = FolderName & "\" & Sheet1.Range("B1")
--
Regards
Roger Govier
"Kevin" wrote in message
...
Hi Roger,
FolderName = BrowseForFolder("E:\2010\Customers\") works now, I's using
forward slashes. Is this popup window will come up everytime when I open
new
renamed workbook?
Secondly that SaveAsCell macro still doesn't work
FolderName = BrowseForFolder("E:\2010\Customers\")
it just opens popup window again.
On Error GoTo InvalidName
strName = FolderName & Sheet1.Range("B1")
ActiveWorkbook.SaveAs strName
FYI in Cell "B1" I got a formula which reads the drive letter +
concatenate
text
Formula in Cell B1
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1) + some other
text which I use to save the workbook.
Is this stuffing up something?
As per my understanding:
Sub Auto_Open() functions knows the Foldername where we are now that's why
I
can read the files in that specific folder
But
Sub SaveAsCell() macro doesn't know the current directory where we are.
So
need to pick some code from Sub Auto_Open() ??
Thanks once again Roger,
Cheers,
Kevin
"Roger Govier" wrote:
Hi Kevin
FolderName = BrowseForFolder("E:\2010\Customers\")
(Note all paths have a backslash \ not a forward slash / as you have been
typing)
for the Saving, I think you will need to select folder again by inserting
the line of code in your sub
Sub SaveAsCell()
Dim strName As String, FolderName as string
FolderName = BrowseForFolder("E:\2010\Customers\")
On Error GoTo InvalidName
strName = FolderName & Sheet1.Range("B1")
ActiveWorkbook.SaveAs strName
Exit Sub
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, " "
End Sub
--
Regards
Roger Govier
__________ Information from ESET Smart Security, version of virus
signature database 4839 (20100205) __________
The message was checked by ESET Smart Security.
http://www.eset.com
__________ Information from ESET Smart Security, version of virus signature database 4839 (20100205) __________
The message was checked by ESET Smart Security.
http://www.eset.com