johnny51981
Active Member
- Joined
- Jun 8, 2015
- Messages
- 409
My VBA knowledge, at this time, is basically plagiarism or crying for help.
I have a single workbook that I am needing to export 2 of its sheets to 2 different locations. At least that is the hope, rather than having to do the movement manually as I am trying to save every second I can in my workday.
ExportActiveTask is currently exporting to the same location as the source workbook, which is fine.
ExportGoalECCD is to be exported to a specific network location, which I have created a Named Range with the full path. Named Range is "GoalECCD".
When I run the macros, they both go to the same location, being the ThisWorkbook.Path, even though the ExportGoalECCD has that line of code deactivated.
Any help at getting these to part ways rather than maintaining their codependency would be greatly appreciated.
My current code
Thanks in advance!
I have a single workbook that I am needing to export 2 of its sheets to 2 different locations. At least that is the hope, rather than having to do the movement manually as I am trying to save every second I can in my workday.
ExportActiveTask is currently exporting to the same location as the source workbook, which is fine.
ExportGoalECCD is to be exported to a specific network location, which I have created a Named Range with the full path. Named Range is "GoalECCD".
When I run the macros, they both go to the same location, being the ThisWorkbook.Path, even though the ExportGoalECCD has that line of code deactivated.
Any help at getting these to part ways rather than maintaining their codependency would be greatly appreciated.
My current code
VBA Code:
Sub ExportActiveTask()
Application.ScreenUpdating = False
ChDir ThisWorkbook.Path
Application.DisplayAlerts = False
ThisWorkbook.Sheets("TASK DATA").Copy
ActiveWorkbook.SaveAs Filename:="Active Tasks.CSV", FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close
MsgBox "Active Task file export is now complete"
End Sub
Sub ExportGoalECCD()
Application.ScreenUpdating = False
'ChDir ThisWorkbook.Path
ChDir Range("GoalECCD")
Application.DisplayAlerts = False
ThisWorkbook.Sheets("GOAL ECCD").Copy
ActiveWorkbook.SaveAs Filename:="Goal ECCD by Job.CSV", FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close
MsgBox "Goal ECCD by Job file export is now complete"
End Sub
Thanks in advance!