Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running macro in another workbook

Am not a VBA power user but was wondering if someone could help. Does
anyone have code for opening a workbook(2) from another workbook(1)
and then running a macro in workbook(2)?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Running macro in another workbook

In workbook(1) enter this in Thisworkbook module.

Edit for path and filename, of course.

Private Sub Workbook_Open()
Workbooks.Open Filename:= _
"C:\Program Files\Microsoft Office\Exceldata\12months.xls"
End Sub

In workbook(2) enter this in a general module

Sub hoohah()
msgbox "hello hoohah"
End Sub

In Thisworkbook module enter

Private Sub Workbook_Open()
hoohah
End Sub

Close and save both workbooks.

Open workbook(1) and see what happens.


Gord Dibben MS Excel MVP


On Mon, 31 Aug 2009 14:56:18 -0700 (PDT), Gareth
wrote:

Am not a VBA power user but was wondering if someone could help. Does
anyone have code for opening a workbook(2) from another workbook(1)
and then running a macro in workbook(2)?


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
How do I call up a line of code that references a cell/range in theactive workbook workbook where I am running my macro from? Lav Excel Programming 2 November 11th 08 05:04 PM
Running macro in another workbook Barb Reinhardt Excel Worksheet Functions 1 April 25th 07 08:30 PM
Help:Running a macro in one excel workbook from another workbook R Kapoor Setting up and Configuration of Excel 3 January 13th 06 05:11 AM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
Running a macro in another workbook Blue Excel Programming 4 July 9th 04 07:38 PM


All times are GMT +1. The time now is 03:44 AM.

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

About Us

"It's about Microsoft Excel"