Results 1 to 5 of 5

Excel Border Line style works for the first time I run the code, later it shows some error

Threaded View

  1. #1
    Registered User
    Join Date
    07-11-2014
    Location
    Coimbatore, India
    MS-Off Ver
    2010
    Posts
    5

    Excel Border Line style works for the first time I run the code, later it shows some error

    Hi,

    I am trying to generate a automatic report in excel format by using VB6.

    To draw borders in the excel file, I recorded a macro in one excel and found out the syntax from there.

    It works perfectly for the first time, and if dont end the program and try to generate another report it gives me an error which says "The remote server machine does not exist or unavailable".

    Anybody please help me with this..

    Error message highlights the first line of this code.

     Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlMedium
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlMedium
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlMedium
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlMedium
        End With
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        With Selection.Borders(xlEdgeLeft)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeTop)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeBottom)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlEdgeRight)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideVertical)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
        With Selection.Borders(xlInsideHorizontal)
            .LineStyle = xlContinuous
            .ColorIndex = 0
            .TintAndShade = 0
            .Weight = xlThin
        End With
    Last edited by vidyaduttk; 07-11-2014 at 01:13 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Run time error 1004 - why is the last line of this code causing this?
    By SweetSorcery in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 07-14-2014, 06:57 AM
  2. [SOLVED] run time error 91 - but code works in another spreadsheet ?
    By pmasrich in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2013, 07:32 AM
  3. [SOLVED] Excel 2010: Run-time error at .Chart.Paste line within With statement (works on 2003/2007)
    By JohnMcCallum in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-04-2012, 11:53 AM
  4. Why do I get Run-time error 91 on this line of code?
    By ThomasHaller in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-17-2012, 04:48 PM
  5. excel 2007 frame border style
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2009, 03:48 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1