C
Chip
I tried reading on this group and others about using Application.Run.
Basically, I am trying to have one workbook run a macro that is in
another workbook. I can get the "Master" workbook to call the macro in
the other workbook, but when the code is finished I want it to finish
running the code back in the Master Workbook (like a normal call
would). Is there a way to do this?
Here is my code from the "Slave" workbook:
Public Sub Saveaftereview()
If IsEmpty(Range("A25").Value) Then
Dim startingname As String
startingname = "Position Control-" & Range("A50").Value & "-" &
Range("B50").Value & "-" & Range("C50").Value & ".xls"
Dim myFileName As Variant
myFileName = Application.GetSaveAsFilename _
(InitialFileName:="c:\" & startingname)
Else
myFileName = Range("A25").Value
End If
If myFileName = False Then
'user hit cancel
Else
Sheets("Save Page").Visible = False
Sheets("Travelers Worksheet").Select
ActiveSheet.Buttons(1).Select
selection.OnAction = "Addworksheet"
Range("A7").Select
'Added as of January 10th 2006
Sheets("LOA Worksheet").Select
ActiveSheet.Shapes("Button 1").Select
selection.OnAction = "Addworksheet"
Range("A4").Select
Sheets("Job Postings Worksheet").Select
ActiveSheet.Shapes("Button 1").Select
selection.OnAction = "Addworksheet"
Range("A4").Select
Sheets("Position Control").Select
Call protector
Range("A13").Select
ActiveWorkbook.SaveAs Filename:=myFileName, FileFormat:=xlNormal
ActiveWorkbook.Close
End If
End Sub
In the Master it reads something like Application.Run (Name of the
file)!Saveafterreview
Any thoughts?
Basically, I am trying to have one workbook run a macro that is in
another workbook. I can get the "Master" workbook to call the macro in
the other workbook, but when the code is finished I want it to finish
running the code back in the Master Workbook (like a normal call
would). Is there a way to do this?
Here is my code from the "Slave" workbook:
Public Sub Saveaftereview()
If IsEmpty(Range("A25").Value) Then
Dim startingname As String
startingname = "Position Control-" & Range("A50").Value & "-" &
Range("B50").Value & "-" & Range("C50").Value & ".xls"
Dim myFileName As Variant
myFileName = Application.GetSaveAsFilename _
(InitialFileName:="c:\" & startingname)
Else
myFileName = Range("A25").Value
End If
If myFileName = False Then
'user hit cancel
Else
Sheets("Save Page").Visible = False
Sheets("Travelers Worksheet").Select
ActiveSheet.Buttons(1).Select
selection.OnAction = "Addworksheet"
Range("A7").Select
'Added as of January 10th 2006
Sheets("LOA Worksheet").Select
ActiveSheet.Shapes("Button 1").Select
selection.OnAction = "Addworksheet"
Range("A4").Select
Sheets("Job Postings Worksheet").Select
ActiveSheet.Shapes("Button 1").Select
selection.OnAction = "Addworksheet"
Range("A4").Select
Sheets("Position Control").Select
Call protector
Range("A13").Select
ActiveWorkbook.SaveAs Filename:=myFileName, FileFormat:=xlNormal
ActiveWorkbook.Close
End If
End Sub
In the Master it reads something like Application.Run (Name of the
file)!Saveafterreview
Any thoughts?