Solved

Doevents question

Posted on 2009-05-13
1
547 Views
Last Modified: 2012-05-06
I am writing a vb.net (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"
 
        Application.Doevents
 
        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 = "rutledj@rjrt.com"
 
        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").Select()
        oSheet.Range("B2:K10").Font.Bold = True
        oSheet.Range("B2:K10").Font.Underline = True
        oSheet.Range("A1").Select()
 
 
        
 
 
 
    End Sub

Open in new window

0
Comment
Question by:rutledgj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Aanvik earned 500 total points
ID: 24378631
Change Application.DoEvents with following.
System.Windows.Forms.Application.DoEvents


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

737 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