Open a file and start macro from macro in another file

Fryer Tuck

Board Regular
Joined
Mar 20, 2002
Messages
64
I am trying to have a macro in a particular file open another file and have it start a macro in that file. I can get it to open the file, but not get the macro to start. I have used RunAutoMacros w/ xlAutoOpen, but I either get errors or no macro running after the file opens.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
On 2002-03-21 21:17, Fryer Tuck wrote:
I am trying to have a macro in a particular file open another file and have it start a macro in that file. I can get it to open the file, but not get the macro to start. I have used RunAutoMacros w/ xlAutoOpen, but I either get errors or no macro running after the file opens.


Try [untested]

Application.Run "'Theworkbook.xls'!MacroName"


Ivan
 
Upvote 0
Using VBA in Excel 2000
In response to a command button on a form, the following code is executed:

Workbooks.Open (FileName:=Path and file, Password:= password to open).Activate

Application.Run "'workbook.xls'!macro"

I tried this with "RunAutoMacos xlAutoOpen" in place of the "Activate", but still didn't get anywhere.
 
Upvote 0
On 2002-03-21 23:47, Fryer Tuck wrote:
Using VBA in Excel 2000
In response to a command button on a form, the following code is executed:

Workbooks.Open (FileName:=Path and file, Password:= password to open).Activate

Application.Run "'workbook.xls'!macro"

I tried this with "RunAutoMacos xlAutoOpen" in place of the "Activate", but still didn't get anywhere.

This worked for me;

Private Sub CommandButton1_Click()
Workbooks.Open Filename:="C:ExcelFilesUsefulVBA Get GUID.xls", password:="test"
Application.Run "'VBA Get GUID.xls'!MoreReferenceWork"
End Sub


Ivan

check your coding ??
 
Upvote 0
Could there be some switch in Excel that is blocking this? I am still getting the Run-time error 438"Object doesn't support this property or method"
 
Upvote 0
Hi Fryer


If you are using the Auto_open (check out Workbook_open) you will need the "RunAutoMacros" Method

Workbooks.Open (FileName:=Path and file, Password:= password to open)
ActiveWorkbook.RunAutoMacros
 
Upvote 0

Forum statistics

Threads
1,213,556
Messages
6,114,284
Members
448,562
Latest member
Flashbond

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top