From: David Morrison Date: 2014-11-11T14:19:19-06:00 Subject: [ruby-core:66213] Re: Excel saveas using a variable --001a1140e2c88378a905079afea1 Content-Type: text/plain; charset=UTF-8 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 > 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 > >> > >> > > > --001a1140e2c88378a905079afea1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Oh, okay!
So what's the answer? LOL
<= /div>

On Tue, Nov = 11, 2014 at 9:46 AM, Marc-Andre Lafortune <ruby-core-ma= iling-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 op= ens excel,
> enters the info, then I want it to save as the Address.
>
> And that is where I am having the problem.
>
> Thanks.
>
>>=C2=A0 ents=3DSketchup.active_model.active_entities
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0prompts =3D ["Company Name&q= uot;, "Address","One","Two","Three"= ,"Four"]
>>=C2=A0 =C2=A0 =C2=A0defaults =3D ["My Co","69 Your S= treet",1.0,2.0,3.0,4.0]
>>=C2=A0 =C2=A0 =C2=A0input =3D UI.inputbox prompts, defaults, "= Risers"
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a,b,c,d,e,f=3Dinput
>> ent =3D Sketchup.active_model.entities
>>=C2=A0 pts =3D []
>>
>> pts[0] =3D [0,c,0]
>> pts[1] =3D [0,d,0]
>> pts[2] =3D [0,0,e]
>> pts[3] =3D [0,0,f]
>>
>>=C2=A0 # Add the face to the entities in the model
>> face =3D ent.add_face pts
>>=C2=A0 face.pushpull 4
>> #Open excel and enter info
>>=C2=A0 =C2=A0require('win32ole')
>>=C2=A0 =C2=A0 excel =3D WIN32OLE.new('Excel.Application') >>=C2=A0 =C2=A0 excel.Visible =3D true
>>=C2=A0 =C2=A0workbook =3D excel.Workbooks.Open('C:\TestFolder\T= est.xlsx')
>>=C2=A0 =C2=A0 ws =3D workbook.Worksheets(1)
>>
>> ws.Cells(1,1).Value =3D a
>> ws.Cells(1,2).Value =3D b
>> ws.Cells(1,3).Value =3D c
>> ws.Cells(1,4).Value =3D d
>> ws.Cells(1,5).Value =3D e
>> ws.Cells(1,6).Value =3D f
>>
>>=C2=A0 =C2=A0# workbook.SaveAs("C:\TestFolder\" + b + &qu= ot;.xlsx")#trying to get
>> 'Customer Address' as the saved workbook
>>
>>
>

--001a1140e2c88378a905079afea1--