RSView32 VAB Print Screen

Compass

Member
Join Date
Feb 2015
Location
Goderich
Posts
101
Hi

I'm trying to make a button in RSView32 that will trigger visual basic code to do a print screen and save a timestamped bitmap image to the desktop.

The button triggers the VBAExec command

I have this code to try:
https://officeaccelerators.wordpres...e-to-take-screenshot-and-save-as-bitmap-file/

I'm having trouble with the Visual Basic Editor.

Can I create a little sub file, like a macro or an event, or does it just run one visual basic for the whole project?
 
AppStart or AppActivate might provide an alternate method. I could probably use them to activate a script file instead of using the VBA editor on RSView.
 
Okay, I have something that works. It's not the best, but I'll post it.

First, the pb on my rsview screen calls a subroutine in the main project. The command is:

VBAExec PrntScrn

Next I need to have a subroutine in the main VBA, but for neatness I just uses a short subroutine to call a longer module:

Sub PrntScrn()
Call ScrnCap.PrintScreen
End Sub

Finally, I need a subroutine that actually does the job.

This seems to work well. I don't like using the Sendkeys method, but I'm not really experienced enough to get around it, and it requires mspaint be installed. (We strip our computers of anything but what they need for operations).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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_SNAPSHOT = &H2C



Sub PrintScreen()

'Copy Window Onto Clipboard
keybd_event VK_SNAPSHOT, 1, 0, 0

'variables
Dim x
Dim fname As String
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")

'Open mspaint
WshShell.Run "mspaint"
WshShell.AppActivate "mspaint"

'Wait
x = Now + TimeValue("0:00:02")
Do Until Now > x
Loop

'Paste
WshShell.SendKeys "^(v)"

'Wait
x = Now + TimeValue("0:00:02")
Do Until Now > x
Loop

'Save
WshShell.SendKeys "^(s)"

'Wait
x = Now + TimeValue("0:00:01")
Do Until Now > x
Loop

fname = "C:\ScrnCap" & " " & Format(Now(), "yyyy-MM-dd hh-mm-ss") & ".bmp"

WshShell.SendKeys fname

End Sub
 
I did this using SnagIt and a 1 line VBA script to just emulate the button press.

I like what you came up with though!
 

Similar Topics

I'm importing an RSView32 project into FTView SE. I'm using Legacy Tag Database Conversion on a virtual machine with Windows XP, I did the first...
Replies
0
Views
373
Hi everybody, I have a rsview32 application, when I try to run it it loads upto 80% system settings and the crashes saying Rsview32 Project...
Replies
3
Views
1,910
Hi Guys I'm having trouble assigning a tag to an activex label on a Multipage Tab. I can assign the tag to an active x label on a normal display...
Replies
0
Views
596
I have followed the procedure below to convert RSView32 project to FactoryTalk View...
Replies
5
Views
1,431
I have converted RSV32 to FTVSE Distributed. pretty straightforward... I cant seem to figure out how or find any documentation to migrate RSV32...
Replies
4
Views
2,305
Back
Top Bottom