Application.Run problem.

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?
 
B

Bob Phillips

Aren't you closing the book with the code in it, thereby effectively
aborting the code?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
C

Chip

Yes, yes I am. I sware I tried the code without that in it and still
had the same problem, but I messed with the code and it works now.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top