Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 363
Default Is there an easy Copy/Paste of a Userform ? (Entire Userform Including tx & cbx's)



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Is there an easy Copy/Paste of a Userform ? (Entire Userform Including tx & cbx's)

Modification of code originally posted by
"Orlando Magalhães Filho"

Modified to capture just the userform (not the whole window).

' Placed at the top of a general module above any other code:
Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

'Public Const VK_SNAPSHOT = &H2C

Public Const VK_SNAPSHOT = 44
Public Const VK_LMENU = 164
Public Const KEYEVENTF_KEYUP = 2
Public Const KEYEVENTF_EXTENDEDKEY = 1


Sub Test()
UserForm1.Show
End Sub


In the userform module:




Private Sub CommandButton1_Click() '<== change to the Commandbutton you use
or trigger some other way
' keybd_event VK_SNAPSHOT, 0, 0, 0
DoEvents
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0 ' key down
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
DoEvents
Workbooks.Add
Application.Wait Now + TimeValue("00:00:01")
ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False,
DisplayAsIcon:=False
End Sub



--
Regards,
Tom Ogilvy

"Corey" wrote in message
...




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Is there an easy Copy/Paste of a Userform ? (Entire Userform Including tx & cbx's)

Tom's answer assumes you want a picture of the userform. I read your
question to mean you wanted a second copy of the form.

One way: Export the form, change the name of the existing form, and import
the original.

Another way: Drag the form into another VB Project (just create a new
temporary workbook for this), change the name of either form, and drag the
form beck into the original project.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"Corey" wrote in message
...




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy & paste image from UserForm (repost) Paul Martin Excel Programming 6 May 30th 05 07:14 AM
Copy & paste image from UserForm Michel Pierron Excel Programming 1 May 6th 05 02:29 AM
UserForm including TextBox with date (UK format) John Elink Excel Programming 2 December 1st 04 09:02 AM
Easy Userform question David Jensen Excel Programming 2 April 16th 04 01:19 AM
copy-paste in a userform Hatzipavlis Stratos Excel Programming 2 November 13th 03 10:24 AM


All times are GMT +1. The time now is 10:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"