I have used a previous version of this code to save file to a parent folder, but decided to modify it to save to more customer specific folder. BUT, if I try to save this work to my template then run, it somehow disables all macros links and does not give security messagebar to enable?????? (code still works in VBA window, but all GUI links say macros have been disabled...and no security warning messagebar at all)
VBA Code:
Sub GoogleContact()
Dim strFilename, strDirname, strPathname, strDefpath As String
On Error Resume Next
Worksheets("Dashboard").Select
strDirname = Range("A4").Value
strFilename = Range("A4").Value & "_Google"
strDefpath = "C:\MidSouth\PENDING\"
If IsEmpty(strDirname) Then Exit Sub
If IsEmpty(strFilename) Then Exit Sub
MkDir strDefpath & strDirname
strPathname = strDefpath & strDirname & "\" & strFilename
If Not Right(MyFileName, 4) = ".csv" Then MyFileName = MyFileName & ".csv"
Sheets("Google").Copy
Application.DisplayAlerts = False
With ActiveWorkbook
.SaveAs filename:=strPathname, _
FileFormat:=xlCSV, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End With
End Sub
Last edited: