.Fillcolor Problem from Publisher VB to VB6

M

mcwhirt3

Hello,

I am moving some vb i orignally created in publisher to VB6 to make
and add-in out of. Most of the code and userforms exported nicely,
however some of the code didn't take. My biggest problem is in filling
some wordart with a color. Below is the code i wanted to take into my
add-in. The "fillColor" property always gives me an error when i make
my .dll file. I am using publisher 2003 (11.0) and i have checked the
refrences to include office 11 and publisher 11 object library. I get
the error "invalid qualifier" when making the .dll. I see i can use
"fillcolor" as a property via intellisense but i think the rest of the
line isn't being read the same in vb6. Does anyone know why? Thanks for
any help!!

--------------------------------------------------------------------------------------
Private Sub CommandButton1_Click()

Dim shpWordArt As Shape

Set shpWordArt = ActiveDocument.Pages(1).Shapes.AddTextEffect _
(PresetTextEffect:=msoTextEffect7, Text:=TextBox1.Value, _
FontName:="Nino Salvaggio Sign", FontSize:=125, _
FontBold:=msoFalse, FontItalic:=msoFalse, _
Left:=144, Top:=72)

shpWordArt.FillColor.ForeColor.RGB = RGB(Red:=255, Green:=102, blue:=0)

TextBox1.Value = ""
TextBox1.SetFocus
Unload orangetext

End Sub
--------------------------------------------------------------------------------------
 
E

Ed Bennett

I see i can use
"fillcolor" as a property via intellisense but i think the rest of the
line isn't being read the same in vb6. Does anyone know why?
shpWordArt.FillColor.ForeColor.RGB = RGB(Red:=255, Green:=102,
blue:=0)

What happens if you replace that line with the following?

shpWordArt.FillColor.ForeColor.RGB = RGB(255, 102, 0)
 
M

mcwhirt3

Hi Ed,

Thanks for the help! I did try that and i still get an invalid
qualifier and it highlights the "fillcolor" property...i thought it
might be the syntax but i can't figure out what else is causing this
error. It drives me crazy becase i can see the "fillcolor" property in
the available commands. any other ideas?
 
E

Ed Bennett

Thanks for the help! I did try that and i still get an invalid
qualifier and it highlights the "fillcolor" property...i thought it
might be the syntax but i can't figure out what else is causing this
error. It drives me crazy becase i can see the "fillcolor" property in
the available commands. any other ideas?

When in doubt, read the object model reference :)

Try replacing FillColor with Fill. According to the OM reference, there is
no such property as FillColor for a Shape object - and I can't see a
FillColor property listed in the IntelliSense for a Shape object in the
Publisher 2003 VBA, either.

I would test this from VB6, too, but I haven't got it installed and can't
spare the hard drive space for it at the moment.
 
M

mcwhirt3

Hi Ed,

I don't know what happend but what you advised before didn't seem to
work and now it does. I thought the least I could do was post the final
answer:

Set shpwordart = ActiveDocument.Pages(1).Shapes.AddTextEffect _
(PresetTextEffect:=msoTextEffect7, Text:=TextBox1.Value, _
FontName:="Nino Salvaggio Sign", FontSize:=125, _
FontBold:=msoFalse, FontItalic:=msoFalse, _
Left:=144, Top:=72)

shpwordart.Fill.ForeColor.RGB = RGB(255, 0, 0)

I swear I tried that a few times and it didn't work..but thanks for
helping me get there.
 
M

mcwhirt3

P.S....I found what the problem was!

Dim shpWordArt As Shape

removing that is what ultimately fixed it. I don't see why it mattered
though because wordart is a shape object. Anyways thanks again Ed!
 
E

Ed Bennett

P.S....I found what the problem was!

Dim shpWordArt As Shape

removing that is what ultimately fixed it. I don't see why it mattered
though because wordart is a shape object. Anyways thanks again Ed!

It's not best practise to use Variants instead of Shapes.

It sounds like you may be declaring a VB shape instead of a Publisher shape,
hence the FillColor instead of Fill.

I would suggest trying:

Dim shpWordArt As Publisher.Shape
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top