Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 3rd, 2003, 04:45 PM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default "No Fill" for Shape Objects

Is there a way in VB to set the fill to "No Fill" and the line to "No Fill" for a Shape Object in Excel?

The Transparency property setting of 1 displays properly on the screen and in printed web pages, but the box outlines are shown in printed Excel spreadsheets. The SchemeColor and RGB property settings give solid fills, but do not seem to have a "No Fill" value.

Set wbc = xl.Application.Workbooks

'Determine workbook and active sheet
counter = 1
Do While (counter <= numberWorkbooks)
   If (wbc(counter).FullName = filePathNameWithExtension) Then
      wbIndex = counter
   End If
   counter = counter + 1
Loop

Set wb = wbc(wbIndex)
Set sht = wb.activeSheet

xStart = 100
yStart = 20
shapeWidth = 50
shapeHeight = 15
Set shp = sht.Shapes.AddShape(msoShapeRectangle, xStart, yStart, shapeWidth, shapeHeight)
shp.Fill.ForeColor.SchemeColor = 6
shp.Fill.ForeColor.RGB = RGB(255, 255, 0) 'This supersedes prior line
shp.Fill.Transparency = 1
shp.Line.Transparency = 1
 
Old September 4th, 2003, 12:35 AM
Registered User
 
Join Date: Aug 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think the lineformat object properties are what you are looking for.

This object controls the border line styles.
 
Old September 5th, 2003, 10:40 AM
Registered User
 
Join Date: Sep 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much for your help.

The following worked to hide the fill and lines in the printed Excel output:

    shp.Line.Visible = msoFalse
    shp.Fill.Visible = msoFalse

The text inside the rectangular shapes was still displayed correctly.

The following did not work (the line borders and fill were hidden on the screen display but were not hidded on the printed output):

    shp.Line.Weight = 0
    shp.Line.Transparency = 1
    shp.Fill.Transparency = 1





Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete object shape name stepdev Excel VBA 0 May 3rd, 2006 11:57 AM
Rotating shape in VBA (not center of shape) Piblon Excel VBA 3 April 13th, 2006 04:04 AM
Saving Shape objects as Bitmap or Jpeg JoePates Java GUI 2 November 30th, 2004 06:03 PM
Saving Shape objects as Bitmap or Jpeg JoePates BOOK: Beginning Java 2 6 August 8th, 2004 10:15 AM
Shape My Command-Please btpoole VB Databases Basics 0 March 7th, 2004 12:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.