|
-
Dec 13th, 2004, 05:19 PM
#1
Thread Starter
Hyperactive Member
*Resolved* Hide/Show Shapes
I'm trying to write a short piece of VBA code which will first of all show a shape (to cover part of the worksheet whilst some calculations are performed) then to hide it again once the calculations are complete.
I thought it would be easy but the code I have doesn't work. The code basically goes like this:
Code:
Shapes("BoxOut1, BoxOut2, BoxOut3").Visible = True
Perform the calcuations
Shapes("BoxOut1, BoxOut2, BoxOut3").Visible = False
This just returns an error though.....I don't think the SHAPE function is something that VBA recognises. I also want to be able to hide/show the shapes without having to select them. I thought that Selecting the shapes first and then using WithSelection....to hide and show them again might work, but I'd rather just use a command and not select them.
Anyone have any ideas?
Cheers
-Rob
Last edited by TheRobster; Dec 14th, 2004 at 07:39 AM.
-
Dec 13th, 2004, 10:59 PM
#2
Re: Hide/Show Shapes
You dont need to select the shape before change its visibility property. You
can use its index property to reference a particular shape in the shapes
collection. VBA does recognise the Shape object. Ex from MS VBA Help:
Code:
Set myDocument = Worksheets(1)
myDocument.Shapes(1).Flip msoFlipHorizontal
myDocument.Shapes("Rectangle 1").Flip msoFlipHorizontal
Also, try using the screenupdating method to update your
changes on the screen during calculations or shapes being shown / hidden.
Its like DoEvents in VB.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Dec 14th, 2004, 07:39 AM
#3
Thread Starter
Hyperactive Member
Re: Hide/Show Shapes
K, I got it working.
Cheers
-Rob
-
Dec 14th, 2004, 08:48 PM
#4
Re: *Resolved* Hide/Show Shapes
No prob.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|