Wrox Programmer Forums
|
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2005, 06:07 AM
Authorized User
 
Join Date: Oct 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered
Default Running Excel VBA Macros

Written a small app in excel which analyses data from various sources and then spits out some data which is then passed to crystal reports. Everything worked fine until I tried to automate it from VB so that it would run on task scheduler.

Now whenever I try and run it I get an error telling me that the first macro can't be found, it thens runs the rest of the macros without issue.

If I step through the code and use a dummy macro as the first it works and all the macros run, if I just run the app and tell it to resume next it still can't find the first real macro.

Tried pausing the macro run so that excel has time to load up properly etc, tried wait and sleep, tried loops that write to the spreadsheet and then access the macro but still always get the same problem.

the workbook incidentally works fine, its only when I try and run it from VB that I have problems..

the code I'm usuing is fairly simple and I have used before and on other workbooks without issue.

    Dim myExcel As Excel.Application

    Set myExcel = CreateObject("Excel.Application")
    myExcel.Visible = false
    myExcel.Workbooks.Open (sPath & sFile)
    myExcel.Run ("Get_My_Data()")
    myExcel.Run ("Update_Stock_List()")
    myExcel.Run ("Update_Price_List()")
    myExcel.Run ("Generate_Files()")

help!






Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Macros not showing up in the run macro menu d.lee84 Access VBA 9 August 21st, 2007 09:37 AM
Excel Macros with VBA kotaiah Excel VBA 1 September 11th, 2006 01:39 AM
Excel Macros with VBA ASAP kotaiah Excel VBA 0 September 9th, 2006 04:55 AM
Excel "Protection" prohibiting macros running Gallus Excel VBA 1 August 5th, 2004 11:26 PM
accessing Macros properties with vba rle123 Access VBA 0 July 17th, 2003 04:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.