ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving Userform as Gif (https://www.excelbanter.com/excel-programming/304686-saving-userform-gif.html)

Robert[_24_]

Saving Userform as Gif
 
Hi,

Anyone got any ideas on how to save a userform through VBA as a gif? Found
plenty on saving a chart as a gif, but can't figure out how to do the same
with a userform.

Thanks



Amedee Van Gasse[_3_]

Saving Userform as Gif
 
Robert wrote:

Hi,

Anyone got any ideas on how to save a userform through VBA as a gif?
Found plenty on saving a chart as a gif, but can't figure out how to
do the same with a userform.

Thanks


I don't want to sound silly, but... how about taking a screenshot?
Using PrtSc, one of the grey keys on the top of your keyboard you
almost never use. And then you paste it in your favorite image editing
software.
Or use image editing software to take screenshots. I use Paint Shop Pro
a lot for taking screenshots of forms, because it gives me the
possibility to capture only a single screen object and not the entire
screen.

PS: I write a lot of user manuals at work, with *a lot* of screenshots
and examples.

--
Amedee Van Gasse

To top-post is human, to bottom-post and snip is sublime.


keepITcool

Saving Userform as Gif
 


Doing PrintScreen with code...

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_SNAPSHOT = &H2C
Private Const VK_MENU = &H12

Sub AltPrintScreen()
keybd_event VK_MENU, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
End Sub

Saving it from the clipbooard is en entirely different matter
good luck :)


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Amedee Van Gasse wrote :

Robert wrote:

Hi,

Anyone got any ideas on how to save a userform through VBA as a gif?
Found plenty on saving a chart as a gif, but can't figure out how to
do the same with a userform.

Thanks


I don't want to sound silly, but... how about taking a screenshot?
Using PrtSc, one of the grey keys on the top of your keyboard you
almost never use. And then you paste it in your favorite image editing
software.
Or use image editing software to take screenshots. I use Paint Shop
Pro a lot for taking screenshots of forms, because it gives me the
possibility to capture only a single screen object and not the entire
screen.

PS: I write a lot of user manuals at work, with *a lot* of screenshots
and examples.



Ron de Bruin

Saving Userform as Gif
 
With Alt-Print Scrn you only capture the userform when it is active
Paste it in Paint and save it

If you want to have a program for this buy Snagit
http://www.techsmith.com/default.asp


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Amedee Van Gasse" wrote in message ...
Robert wrote:

Hi,

Anyone got any ideas on how to save a userform through VBA as a gif?
Found plenty on saving a chart as a gif, but can't figure out how to
do the same with a userform.

Thanks


I don't want to sound silly, but... how about taking a screenshot?
Using PrtSc, one of the grey keys on the top of your keyboard you
almost never use. And then you paste it in your favorite image editing
software.
Or use image editing software to take screenshots. I use Paint Shop Pro
a lot for taking screenshots of forms, because it gives me the
possibility to capture only a single screen object and not the entire
screen.

PS: I write a lot of user manuals at work, with *a lot* of screenshots
and examples.

--
Amedee Van Gasse

To top-post is human, to bottom-post and snip is sublime.




Ivan F Moala[_3_]

Saving Userform as Gif
 
"Robert" wrote in message ...
Hi,

Anyone got any ideas on how to save a userform through VBA as a gif? Found
plenty on saving a chart as a gif, but can't figure out how to do the same
with a userform.

Thanks



There are a number of ways to do this....

1. From my good friend Colo

Works off UserForm_DblClick routine

Option Explicit

Private Declare Sub keybd_event _
Lib "user32" ( _
ByVal bVk As Byte, _
ByVal bScan As Byte, _
ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)

Private Const VK_LMENU = &HA4
Private Const VK_SNAPSHOT = &H2C
Private Const VK_CONTROL = &H11
Private Const VK_V = &H56
Private Const VK_0x79 = &H79
Private Const KEYEVENTF_EXTENDEDKEY = &H1
Private Const KEYEVENTF_KEYUP = &H2



Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim sAppOs As String
Dim wks As Worksheet
'get oparating system
sAppOs = Application.OperatingSystem

Application.DisplayAlerts = False
Application.ScreenUpdating = False

If Mid(sAppOs, 18, 2) = "NT" Then
' WinNT,Windows2000,WindowsXP - Using Win32API
Call keybd_event(VK_LMENU, VK_V, KEYEVENTF_EXTENDEDKEY, 0)
Call keybd_event(VK_SNAPSHOT, VK_0x79, KEYEVENTF_EXTENDEDKEY,
0)
Call keybd_event(VK_LMENU, VK_V, KEYEVENTF_EXTENDEDKEY Or
KEYEVENTF_KEYUP, 0)
Call keybd_event(VK_SNAPSHOT, VK_0x79, KEYEVENTF_EXTENDEDKEY
Or KEYEVENTF_KEYUP, 0)
Else
' Windows95,Windows98,WindowsME
Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0)
Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY Or
KEYEVENTF_KEYUP, 0)
End If
DoEvents
Unload Me
Set wks = Workbooks.Add.Sheets(1)
Application.Goto wks.Range("A1")
ActiveSheet.Paste
wks.SaveAs Filename:="C:\myfile.htm", FileFormat:=xlHtml
wks.Parent.Close False

Application.ScreenUpdating = True
Application.DisplayAlerts = True
MsgBox "Have a look at C:\myfile.files folder."
End Sub

Robert Platts

Saving Userform as Gif
 
Thanks Ivan,

That worked great, with a little extra code it did exactly what I
needed.

Rob



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

[email protected]

Saving Userform as Gif
 
Robert...any chance I can get your end result code for the userform as gif via screenshot?

Thanks

GS[_2_]

Saving Userform as Gif
 
Robert...any chance I can get your end result code for the userform
as gif via screenshot?

Thanks


Well I searched back about 1 year of posts and did not find a subject
as what's to the right of "" in your subject line so can you post
the date of the original thread?

<FWIW
I use Paint Shop Pro for this, and find it works really well. I prefer
to save the images as GIFs because I insert them into the CHMs I use
for UserGuides. This also serves well for images used on websites
and/or HTML-based ebooks.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com