Create folders from log on names

Twiztid Chaos

New Member
Joined
Aug 31, 2011
Messages
1
[FONT=&quot]I have created a Macro in Excel 2003 where we have a form that is filled out by the rest of the company and click a button to have the form save in a specific spot for future references as well as email the dept and the sender. It works very well; however, we are constantly adding and removing departments. With a new department, I literally have to create a new template for that specific area in order to utilize such a form. It has been a while since I did any programming from college, and I'm happy to get as far as I got.

The issue I am having is that I would like to convert the code below to be able to create a folder off of either the computer log on or sender's email address provided the folder is not there. Computer log on is preferred. This would free my time up that would be used else where rather then editing code and keep track of whose template is whose. I've tried different ways of IF statements and I'm somewhat successful.

Getting the log on name is where I'm really struggling. Any suggestions[/FONT]?


Code:
 ActiveWorkbook.SaveAs Filename:="P:\EXAMPLE\EXAMPLE\SUBMITTED REQUESTS\" & _
  Format(Now(), "mm_dd_yyyy hh mm AMPM"), FileFormat:=xlNormal, Password:="", _
  WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
  ActiveWorkbook.SendMail Recipients:="test@email.example"
End Sub
Code:
 Dim Fix_ID As String
    Fix_ID = ActiveSheet.Range("D7").Value
    
  ActiveWorkbook.SaveAs Filename:="P:\EXAMPLE\EXAMPLE\SUBMITTED REQUESTS\NEW\" & _
  Format(Now(), "mm_dd_yyyy hh mm AMPM") & " " & Fix_ID, FileFormat:=xlNormal, Password:="", _
  WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
Dim rcp, hlink, msg, subj
    rcp = "Test@email.example; Start@email.example"
    subj = "Please review this file"
    msg = "Please review file located at: " & "%0A%0A" & "<file: "="" &="" activeworkbook.path="" "\"="" activeworkbook.name="">"
    hlink = "mailto:" & rcp & "?"
        hlink = hlink & "subject=" & subj & "&"
        hlink = hlink & "body=" & msg
        ActiveWorkbook.FollowHyperlink (hlink)
        Application.Wait (Now + TimeValue("0:00:02"))
        Application.SendKeys "%s"
End Sub
</file:>
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,224,584
Messages
6,179,691
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top