Twiztid Chaos
New Member
- Joined
- Aug 31, 2011
- Messages
- 1
[FONT="]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]?
</file:>
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