Open PDF / save value to Clipboard
Open PDF / save value to Clipboard
(OP)
Hi,
I have searched a lot for let my macro (swp in Solidworks) do two things:
1) opening a PDF in AcrobatReader after creating this PDF out of SW;
2) save a value to the windows clipboard
how can i do this?
regards, Peter
I have searched a lot for let my macro (swp in Solidworks) do two things:
1) opening a PDF in AcrobatReader after creating this PDF out of SW;
2) save a value to the windows clipboard
how can i do this?
regards, Peter





RE: Open PDF / save value to Clipboard
RE: Open PDF / save value to Clipboard
RE: Open PDF / save value to Clipboard
"1) opening a PDF in AcrobatReader after creating this PDF out of SW;"
After saving the PDF you can use the API call ShellExecute
"2) save a value to the windows clipboard"
Clipboard.Clear
clipboard.settext "YourStringvalue"
Using ShellExecute
'Declare it
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal _
hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As _
Long
'call it
ShellExecute Me.hwnd, "open", "yourpdffile.pdf", vbNullString, vbNullString, SW_SHOW
Francis
www.controldraw.co.uk
www.s88control.blogspot.com
RE: Open PDF / save value to Clipboard
objData.SetText "Hello World!"
objData.PutInClipboard
objData.GetFromClipboard
Debug.Print objData.GetText
RE: Open PDF / save value to Clipboard
But how do i put the shell execute into my swp-macro? As a function, or in the Sub Main() ? And wich VB library does it need?
regards Peter
see also attached swp macro.
RE: Open PDF / save value to Clipboard
CODE
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal Hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub Open_Pdf()
Dim PdfFile As String
Dim FDir As String
PdfFile = "ooslist.pdf" 'Pdf file name
FDir = "D:\HS" 'Directory where Pdf file exists
ShellExecute 0, "Open", PdfFile, "", FDir, 1
End Sub
RE: Open PDF / save value to Clipboard
regards Peter