Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to run macro of closed excel workbook using VBA


I am required to run macro in closed excel workbook using VBA.
pl help


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default how to run macro of closed excel workbook using VBA

You need to open the workbook first, then use Application.Run to execute the
macro. E.g.,

Workbooks.Open "C:\path\FileName.xls"
Application.Run "FileName.xls!MacroName"
Workbooks("FileName.xls").Close savechanges:=False

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"santoshkumar" wrote in message
...

I am required to run macro in closed excel workbook using VBA.
pl help


------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default how to run macro of closed excel workbook using VBA

Not supported. The workbook has to be open to run a macro.

--
Regards,
Tom Ogilvy

"santoshkumar" wrote in message
...

I am required to run macro in closed excel workbook using VBA.
pl help


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default how to run macro of closed excel workbook using VBA

If you mean run a macro contained in an open workbook and you want the macro
to draw data from a closed workbook, then you might look as SQL.Request on
Andy Wiggins site (see below)

or look at using ADO from Mr. Erlandsen's site:
http://www.erlandsendata.no/english/vba/adodao/

recent post from Andy Wiggins:

Tom, take a look at SQL.REQUEST, the function Microsoft supplies in its
XLODBC add-in. Not only can you use variable references to get data from
closed workbooks, you can also use it to update values in closed workbooks.

For illustrations on how to get data from closed workbooks see:
http://www.bygsoftware.com/examples/...SqlRequest.zip

It's in the "Excel with Access Databases" section on page:
http://www.bygsoftware.com/examples/examples.htm

This workbook demonstrates how to get data direct from an MS Access table,
or from an open or closed MS Excel workbook using the workbook function
SQL.REQUEST.

Recently updated to show the use of SQL.REQUEST in the same workbook.

The code is open and commented.


--

Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"

--
Regards,
Tom Ogilvy



"santoshkumar" wrote in message
...

I am required to run macro in closed excel workbook using VBA.
pl help


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
Excel: Saved & closed workbook. Now locked for editing (?). Rhett Excel Discussion (Misc queries) 5 October 16th 08 12:36 AM
closed workbook macro puiuluipui Excel Discussion (Misc queries) 1 July 4th 08 10:13 PM
Create Move Macro for Closed Workbook Roger Excel Discussion (Misc queries) 3 January 15th 08 02:19 AM
after creating macro button, closed excel then restarted excel hjd43 Excel Discussion (Misc queries) 1 March 3rd 05 03:04 AM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM


All times are GMT +1. The time now is 12:58 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"