Default date in a UserForm box
You can use the UNC path (\\server\sharename\folder\folder) instead of the
mapped drive letter:
Dim myFolder as string
myfolder = "\\server\sharename\folder\folder"
if right(myfolder,1) < "\" then
myfolder = myfolder & "\"
end if
with activeworkbook
.SaveAs _
Filename:=myfolder & "Staging List " _
& Format(.worksheets("whatsheetname").range("Current _date").value, _
"mm-dd-yy") & ".xls", _
FileFormat:=xlWorkbookNormal
end with
excelnut1954 wrote:
Yes, this Google site is excellent!
I have a twist in this project I just discovered this afternoon.
This file resides on a server drive. When I ran the macro including the
Save-as code above, it worked fine. However, I found out I need to
specify the path.
When the person who does the entries each day ran it, the file saved on
his hard drive. It seems that it went to the last place he pulled a
file from, even though it was a different file, which was from his hard
drive. This baffled me, since anytime I've ever run a Save-as from any
program, it always assumes the directory it came from.
Well, I guess I should learn good form, and put it in anyway.
So, I figured out how to show the path as far as the directories go.
But, I'll probably need to show the drive letter also. The problem is
that on different computers in our company, the drive letter can be
different to the same server drive. On my pc, this drive letter is F
On another person's, it's H, and who knows what other letters are being
used to access this same server.
Using the relevant part of the code above, here is what I have so far:
Filename:="\Material Staging List\Staging List " & ........
The server drive is called Public.
So, I assume it would look like
Filename:="\Public\Material Staging List\Staging List " & ........
Will I need to identify the drive letter? I would think so.
In the long run, I want different people to be able to update this file
using the macros I'm designing. How do I get around the drive letter
differentiation from pc to pc?
As always, my humble appreciation to all who take the time to respond.
J.O.
--
Dave Peterson
|