* [ruby-core:66203] Excel saveas using a variable
@ 2014-11-11 13:21 David Morrison
2014-11-11 15:46 ` [ruby-core:66208] " Marc-Andre Lafortune
0 siblings, 1 reply; 3+ messages in thread
From: David Morrison @ 2014-11-11 13:21 UTC (permalink / raw
To: ruby-core
[-- Attachment #1: Type: text/plain, Size: 1170 bytes --]
When I run this code in Sketchup, it performs it's duties, then opens
excel, enters the info, then I want it to save as the Address.
And that is where I am having the problem.
Thanks.
ents=Sketchup.active_model.active_entities
> prompts = ["Company Name", "Address","One","Two","Three","Four"]
> defaults = ["My Co","69 Your Street",1.0,2.0,3.0,4.0]
> input = UI.inputbox prompts, defaults, "Risers"
> a,b,c,d,e,f=input
> ent = Sketchup.active_model.entities
> pts = []
>
> pts[0] = [0,c,0]
> pts[1] = [0,d,0]
> pts[2] = [0,0,e]
> pts[3] = [0,0,f]
>
> # Add the face to the entities in the model
> face = ent.add_face pts
> face.pushpull 4
> #Open excel and enter info
> require('win32ole')
> excel = WIN32OLE.new('Excel.Application')
> excel.Visible = true
> workbook = excel.Workbooks.Open('C:\TestFolder\Test.xlsx')
> ws = workbook.Worksheets(1)
>
> ws.Cells(1,1).Value = a
> ws.Cells(1,2).Value = b
> ws.Cells(1,3).Value = c
> ws.Cells(1,4).Value = d
> ws.Cells(1,5).Value = e
> ws.Cells(1,6).Value = f
>
> # workbook.SaveAs("C:\TestFolder\" + b + ".xlsx")#trying to get
> 'Customer Address' as the saved workbook
>
>
>
[-- Attachment #2: Type: text/html, Size: 1570 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:66208] Re: Excel saveas using a variable
2014-11-11 13:21 [ruby-core:66203] Excel saveas using a variable David Morrison
@ 2014-11-11 15:46 ` Marc-Andre Lafortune
2014-11-11 20:19 ` [ruby-core:66213] " David Morrison
0 siblings, 1 reply; 3+ messages in thread
From: Marc-Andre Lafortune @ 2014-11-11 15:46 UTC (permalink / raw
To: Ruby developers
Please use ruby-lang instead of this mailing list (or
StackOverflow.com) for generic Ruby questions. This mailing list is to
discuss bugs and new features of Ruby.
On Tue, Nov 11, 2014 at 8:21 AM, David Morrison <davesruby@gmail.com> wrote:
> When I run this code in Sketchup, it performs it's duties, then opens excel,
> enters the info, then I want it to save as the Address.
>
> And that is where I am having the problem.
>
> Thanks.
>
>> ents=Sketchup.active_model.active_entities
>> prompts = ["Company Name", "Address","One","Two","Three","Four"]
>> defaults = ["My Co","69 Your Street",1.0,2.0,3.0,4.0]
>> input = UI.inputbox prompts, defaults, "Risers"
>> a,b,c,d,e,f=input
>> ent = Sketchup.active_model.entities
>> pts = []
>>
>> pts[0] = [0,c,0]
>> pts[1] = [0,d,0]
>> pts[2] = [0,0,e]
>> pts[3] = [0,0,f]
>>
>> # Add the face to the entities in the model
>> face = ent.add_face pts
>> face.pushpull 4
>> #Open excel and enter info
>> require('win32ole')
>> excel = WIN32OLE.new('Excel.Application')
>> excel.Visible = true
>> workbook = excel.Workbooks.Open('C:\TestFolder\Test.xlsx')
>> ws = workbook.Worksheets(1)
>>
>> ws.Cells(1,1).Value = a
>> ws.Cells(1,2).Value = b
>> ws.Cells(1,3).Value = c
>> ws.Cells(1,4).Value = d
>> ws.Cells(1,5).Value = e
>> ws.Cells(1,6).Value = f
>>
>> # workbook.SaveAs("C:\TestFolder\" + b + ".xlsx")#trying to get
>> 'Customer Address' as the saved workbook
>>
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ruby-core:66213] Re: Excel saveas using a variable
2014-11-11 15:46 ` [ruby-core:66208] " Marc-Andre Lafortune
@ 2014-11-11 20:19 ` David Morrison
0 siblings, 0 replies; 3+ messages in thread
From: David Morrison @ 2014-11-11 20:19 UTC (permalink / raw
To: Ruby developers
[-- Attachment #1: Type: text/plain, Size: 1697 bytes --]
Oh, okay!
So what's the answer? LOL
On Tue, Nov 11, 2014 at 9:46 AM, Marc-Andre Lafortune <
ruby-core-mailing-list@marc-andre.ca> wrote:
> Please use ruby-lang instead of this mailing list (or
> StackOverflow.com) for generic Ruby questions. This mailing list is to
> discuss bugs and new features of Ruby.
>
> On Tue, Nov 11, 2014 at 8:21 AM, David Morrison <davesruby@gmail.com>
> wrote:
> > When I run this code in Sketchup, it performs it's duties, then opens
> excel,
> > enters the info, then I want it to save as the Address.
> >
> > And that is where I am having the problem.
> >
> > Thanks.
> >
> >> ents=Sketchup.active_model.active_entities
> >> prompts = ["Company Name", "Address","One","Two","Three","Four"]
> >> defaults = ["My Co","69 Your Street",1.0,2.0,3.0,4.0]
> >> input = UI.inputbox prompts, defaults, "Risers"
> >> a,b,c,d,e,f=input
> >> ent = Sketchup.active_model.entities
> >> pts = []
> >>
> >> pts[0] = [0,c,0]
> >> pts[1] = [0,d,0]
> >> pts[2] = [0,0,e]
> >> pts[3] = [0,0,f]
> >>
> >> # Add the face to the entities in the model
> >> face = ent.add_face pts
> >> face.pushpull 4
> >> #Open excel and enter info
> >> require('win32ole')
> >> excel = WIN32OLE.new('Excel.Application')
> >> excel.Visible = true
> >> workbook = excel.Workbooks.Open('C:\TestFolder\Test.xlsx')
> >> ws = workbook.Worksheets(1)
> >>
> >> ws.Cells(1,1).Value = a
> >> ws.Cells(1,2).Value = b
> >> ws.Cells(1,3).Value = c
> >> ws.Cells(1,4).Value = d
> >> ws.Cells(1,5).Value = e
> >> ws.Cells(1,6).Value = f
> >>
> >> # workbook.SaveAs("C:\TestFolder\" + b + ".xlsx")#trying to get
> >> 'Customer Address' as the saved workbook
> >>
> >>
> >
>
[-- Attachment #2: Type: text/html, Size: 2666 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-11 20:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-11 13:21 [ruby-core:66203] Excel saveas using a variable David Morrison
2014-11-11 15:46 ` [ruby-core:66208] " Marc-Andre Lafortune
2014-11-11 20:19 ` [ruby-core:66213] " David Morrison
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).