Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

I'm having a tough time trying to add an underline border in a specific Excel Worksheet cell and need some help.

 

With excelWorksheet
'blah, blah
   .Cells(row, col).Borders... it always crashes here
End With

 

Thanks,

Dan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

  • *Experts*
Posted

Hi SonicBoomAu,

 

I had looked at your previous post earlier and am trying to get the interior border of a single cell as a bottom line.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

Hi DiverDan,

 

Have you tried using .range instead of .cells?

 

Could you apply border around the required cell, then set the border around the ajoining cell to no border?

 

I.E.

 

With objSheet
      .Range("C2").BorderAround()
      .Range("B2").BorderAround(BorderStyle.None)
      .Range("C1").BorderAround(BorderStyle.None)
      .Range("D2").BorderAround(BorderStyle.None)
End With

 

Haven't tried, but I think it would do the job. Not the best but might be able to get you past this spot until someone else knows how to fix.

 

P.S. Just found this web site

http://support.microsoft.com/default.aspx?scid=kb;en-us;213622

 

With range("C2").Borders(Excel.XlUnderlineStyle.xlUnderlineStyleSingle)
               .Weight = Excel.XlLineStyle.xlContinuous
               .ColorIndex = 3
           End With

 

Hope this helps

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

-- Rick Cook, The Wizardry Compiled

  • *Experts*
Posted

Thanks SonicBoomAu!!!!

 

This works great for the main lines...I'll work on the individual cells later.

With excelWorksheet
'Blah, Blah
   With .Range("A1:F1").Borders(Excel.XlBordersIndex.xlEdgeBottom)
       .LineStyle = Excel.XlLineStyle.xlContinuous
       .Weight = Excel.XlBorderWeight.xlThin
       .ColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic
   End With
End With

 

I really can't thank you enough as this was the last bit needed for a special report due tommorrow morning at 8:00 am.

 

Thanks,

Dan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

No probs DiverDan,

 

Just glad I could help.

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

-- Rick Cook, The Wizardry Compiled

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...