Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
application run problem? John Excel Programming 5 August 15th 05 02:18 PM
Application.Match problem Tom Ogilvy Excel Programming 1 September 22nd 04 07:45 PM
The old application.quit problem Hafeez Excel Programming 1 June 21st 04 10:53 AM
Application Problem Stuart[_10_] Excel Programming 7 November 16th 03 05:44 PM
Problem in running an application Mohanasundaram[_2_] Excel Programming 0 August 5th 03 08:26 AM


All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"