Doevents question

Posted on 2009-05-13
Last Modified: 2012-05-06
I am writing a (2005) app that will automate excel. I have a simple label on a form to act as a status indicator. I'm trying to set the status and wanted to use DoEvents to make it refresh but I can't seem to access that function.

When I place it in the code I get the error:  DoEvents is not a member of Microsoft.Office.Interop.Excel.Application

It seems to be confused as to what the application object is referring to.

Private Sub CreateDiscountCalendarHeader()

        lblStatus.Text = "Creating SSOI Discount Calendar Header"


        reportName = "test.xls"

        '** create excel report column headers

        oXL = CType(CreateObject("Excel.Application"), Excel.Application)

        oWB = oXL.Workbooks.Add

        With oXL

            .Visible = True

        End With

        oSheet = CType(oWB.Worksheets.Add, Worksheet)

        oSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape

        oSheet.PageSetup.PrintGridlines = False

        With oXL.ActiveWindow

            ' .DisplayGridlines = False

            ' .DisplayHeadings = False

        End With

        CalDate = Now.ToString

        DirectName = "MCLANES"

        DirectAddress = "401 N. Main St. Winston-Salem, NC 27320"

        SAPContactEmail = ""

        oSheet.Cells(2, 2) = "Promotional Allowance Calendar Statement For:    " & CalDate.ToString

        oSheet.Cells(4, 2) = "Calendar Information Distributed to: " & DirectName

        oSheet.Cells(4, 8) = DirectAddress

        oSheet.Cells(6, 2) = "Sent to: "

        oSheet.Cells(6, 4) = SAPContactEmail

        oSheet.Cells(8, 2) = "Promotional Allowance rates and brands are subject to change"

        oSheet.Cells(10, 2) = "ID#"

        oSheet.Cells(10, 6) = "Name"

        oSheet.Cells(10, 11) = "Address"


        oSheet.Range("B2:K10").Font.Bold = True

        oSheet.Range("B2:K10").Font.Underline = True



    End Sub

Open in new window

Question by:rutledgj
1 Comment

Accepted Solution

Aanvik earned 500 total points
ID: 24378631
Change Application.DoEvents with following.


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now