Results 1 to 2 of 2

Thread: EXCEL formating

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2005
    Posts
    156

    EXCEL formating

    I am not sure why this is happening, but I have an app in which I use the following code to format some cells
    VB Code:
    1. xlBook = xlApp.Workbooks.Open(strFileName)
    2.             xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
    3.  
    4.             Dim xlRange As Excel.Range = xlSheet.Range("A1:A1")
    5.             xlRange.Font.Bold = True
    6.  
    7.             xlRange = xlSheet.Range("A1:B1")
    8.             xlRange.EntireRow.Font.Bold = True
    9.             xlRange = xlSheet.Range("A2:A2")
    10.             xlRange.EntireRow.Font.Bold = True
    11.             xlRange = xlSheet.Range("A3:A3")
    12.             xlRange.EntireRow.Font.Bold = True

    Using this code in vb 2003 works fine, however in vb2005 I can't get it to work. THere are no errors or anything, but when the program is done I see no changes in the excel sheet

    anybody has any ideas????

  2. #2
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: EXCEL formating

    Quote Originally Posted by morpheus3230
    VB Code:
    1. Dim xlRange As Excel.Range = xlSheet.Range("A1:A1")
    I'm surprised that you can assign an object within the Dim statement. I always thought you had to use Set xlRange = blah. Of course, I'm using Excel 2002. Maybe that makes a difference.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width