Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Shapes with uncoded shadow

0

I have encountered a frustrating issue using excel 2013.

Shapes I have previously created via code now appear with an unwanted, uncoded shadow. Nothing has changed within my code which has worked fine via a button click event but now the shadows appear, seemingly, and randomly, for no reason.

I can remove them if I add a line to my code...

.shadow.visible = false

I just can't see why this is now needed.

Can you please help?

Answer
Discuss

Answers

0
Selected Answer

It's not possible to tell what your code does or doesn't do without looking at the code. However, since you didn't publish your code I guess you want an educated guess.

When a shape is created all of its properties are set. As a rule you might actually set just a few of them yourself (in your code) relying of Excel to provide default values for all the others. There is a setting somewhere by which you can define a particular shape as "default", meaning all shapes created after that will have the same default properties you set for it. This could be done manually or by code.

It is possible that Excel 2013 handles this process slightly different from an earlier Excel version. Just as an example (probably not real) you have had to press a button previously but now the last defined shape will automatically become the default for the next. This system might be applied to all, some or just one of the shape properties, for example, the Shadow.Visible property.

Of course, your code works within this system. It creates a shape and specifies some of its properties, might even set those properties as default (which would include many other properties as well because a template includes all of them). Then a next shape is created which mustn't necessarily have the same default properties as the last one anymore. Look at the code and see what it does. Make sure that you don't change the defaults manually in some way in between different runs of the code.

Best solution is to set all properties by code and thereby exclude any automatic help from Excel. If you have full control Excel will not interfere. Or, Excel will only interfere where you don't take control. If you create many shapes and want them to have the same properties, write a function which creates a shape and call that function with different parameters, for example regarding its position or size but5 including Shadpw.Visible property.

Discuss

Discussion

Thank you, Variatus, for your swift response.
I now have a "train of thought" to work with.
Very much appreciated.
Greg (rep: 2) May 31, '18 at 8:25 am
Great! I'm glad I could help. It would be nice for this thread if you would post your solution as a separate answer to your own question - when you have found it. :-)
Variatus (rep: 4889) May 31, '18 at 8:53 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login