Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.Run problem.
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.Run problem.
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) "Chip" wrote in message ups.com... 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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Application.Run problem.
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
application run problem? | Excel Programming | |||
Application.Match problem | Excel Programming | |||
The old application.quit problem | Excel Programming | |||
Application Problem | Excel Programming | |||
Problem in running an application | Excel Programming |