Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 22nd, 2004, 01:46 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copying controls from Excel Sheet

Hi
I am facing some problem in copying controls on excel sheet.
I have used
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

This function copy only the content and not the controls.
I don't wanna use copy method because it copies the entire sheet with formulae, image and button.
Please suggest me some alternative.

Regards,
Gaurav

Reply With Quote
  #2 (permalink)  
Old June 27th, 2004, 12:10 PM
Authorized User
 
Join Date: Aug 2003
Location: Penn Yan, New York, USA.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Suggest you place controls on a toolbar rather than on the worksheet itself.


Reply With Quote
  #3 (permalink)  
Old June 27th, 2004, 01:29 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you tried this one - got it with the macroeditor!
I expect you should set a reference to Microsoft Forms x.x Object Library under Tools-References.

   ActiveSheet.Shapes("CommandButton1").Select
    Selection.Copy
    Range("I28").Select
    ActiveSheet.PasteSpecial Format:="Microsoft Forms 2.0 CommandButton-objekt", _
        Link:=False, DisplayAsIcon:=False
Reply With Quote
  #4 (permalink)  
Old June 27th, 2004, 03:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , Denmark.
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you know you don't want to copy e.g. comments, but all other shapes on the sheet, try this one:

Sub MoveControls()
Dim sh As Shape
Dim T, L As Integer

Sheets("Sheet1").Select
    For Each sh In ActiveSheet.Shapes
    If sh.Type <> msoComment Then
        T = sh.Top
        L = sh.Left
        sh.Copy
            Sheets("Sheet2").Select
                ActiveSheet.PasteSpecial Format:="Microsoft Forms 2.0 CommandButton-objekt", _
                Link:=False, DisplayAsIcon:=False
        sh.Select
        Selection.Top = T
        Selection.Left = L
    End If

    Sheets("Sheet1").Select
    Next
End Sub
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying code from one sheet to another jdd0x01 Excel VBA 0 May 28th, 2007 08:11 PM
Copying Xl sheet from one Xl file to another kesavan Excel VBA 1 July 3rd, 2006 11:11 PM
write multi-sheet Excel w/o Excel.Application manmoth Classic ASP Components 2 November 22nd, 2005 10:56 AM
copying an excel list balllian Excel VBA 2 October 15th, 2004 03:54 AM
Copying controls at run time aspadda Excel VBA 0 November 12th, 2003 01:07 PM



All times are GMT -4. The time now is 05:03 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.