Subject: | Re: Cut and Paste - Table into Excel -
| Date: | Wed, 15 Aug 2018 08:23:53 -0400
| From: | "Steven Green" <greens@diamondsg.com>
| Newsgroups: | pnews.paradox-programming
|
nothing like finding a proc w/o a written parameter list to work from.. fun
times !! :-)
--
Steven Green
Myrtle Beach, South Carolina, USA
http://www.OasisTradingPost.com
Collectibles and Memorabilia
Vintage Lego Sets and Parts
- and Paradox support, too
"Robert MacMillan" wrote in message
news:5b7376a6$1@pnews.thedbcommunity.com...
Finally Solved. Yay.
Syntax required is sel.Invoke("PasteSpecial", "Text") - other parameters
are not required but presumably can be added.
So now we know that we should be able to do most things available in VBA
directly from paradox.
Thanks for the suggestions along the way as they all help with the puzzle.
Robert
On 15/08/2018 10:31 AM, Robert MacMillan wrote:
> Hello Modridirkac and others.
>
> the VBA Code to do what I need is - dont worry about the naming I have
> not called it anything in particular -
>
> "Sub Macro1()
> '
> ' Macro1 Macro
> '
>
> '
> Range("A2").Select
> ActiveSheet.PasteSpecial Format:="Text", Link:=False, DisplayAsIcon:=
> _
> False
> End Sub"
>
> So when I send
>
> sel.Invoke("PasteSpecial", "Format:=\"Text\"", "Link:=False",
> "DisplayAsIcon:= False")
>
> or any of the variations I have tried I get I get a Paradox Error
> message box of "PasteSpecial Method of range class Failed"
>
> So I am getting very close. A Paste Special is obviously being attempted
> but I dont have the syntax to pass the parameters correctly.
>
> All suggestions appreciated.
>
> Thanks
>
> Robert
>
> On 31/07/2018 5:41 PM, modridirkac wrote:
>> This code works for me.
>> You must have something in the clipboard, before calling this script.
>> You must also have an xls file in tem folder, to open it.
>>
>> This code opens OLE t oexcel, loads file (c:\temp\excel.xlsx) and pasts
>> to cells B5:C8
>> and shows final result in excel.
>>
>> const
>> ; Excel coord. types
>> xlA1 = 1 ; A1
>> xlR1C1 = - 4150 ; R1C1
>> endConst
>>
>> method run(var eventInfo Event)
>> ; paste from clipboard to excel
>> var excel OleAuto
>> Workbooks, sel OLEAuto
>> endVar
>> ; start excel
>> Excel.open("Excel.Application")
>> Excel.DisplayAlerts=false
>>
>> ; open file
>> Workbooks = Excel.Workbooks
>> if WorkBooks.count>0 then return endif
>> Workbooks.invoke("Open", "c:\\temp\\excel.xlsx")
>>
>> ; mark your range
>> s = Excel.convertFormula("B5:C8", xlA1, xlR1C1, True)
>> Excel.goto(s)
>> sel = Excel.Selection
>>
>> ; paste from clipboard to that selection
>> sel.Invoke("PasteSpecial")
>>
>> ; show the result
>> Excel.visible=true
>> endMethod
>>
>>
|