Saving Userform as Gif

R

Robert

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
 
A

Amedee Van Gasse

Robert said:
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.
 
K

keepITcool

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 :
 
I

Ivan F Moala

Robert said:
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
 
J

jatayl02

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

Thanks
 
G

GS

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 "Re:" 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top