Hi kid, Sy sudah coba code ini dibawah tp tidak dpt disave dan tidak bisa bikin value di wbknew, malahan ada error 400 Dim vFile As Variant Dim wbkFile As Workbook vFile = Application.GetOpenFilename If LenB(vFile) <> 0 Then Set wbkFile = Workbooks.Open(vFile) End If wbkfile.activate wbkfile.sheets(1).activate wbkfile.sheets(1).range("a1").select Selection.entirerow.insert Activecell.value ="abc"
Dim wbknew as workbook Set wbknew = workbooks.add Wbknew.saveas "c:\tes\tes.xls" Wbknew.range("a2").value = "bca" Sent from my BlackBerry yg belum lunas -----Original Message----- From: "Kid Mr." <mr.nm...@gmail.com> Sender: belajar-excel@yahoogroups.com Date: Wed, 28 Mar 2012 21:37:10 To: <belajar-excel@yahoogroups.com> Reply-To: belajar-excel@yahoogroups.com Subject: Re: [belajar-excel] membuat workbook baru dan menjalankan macro di workbook tersebut Coba : dim wbkNew as workbook set wbknew=workbooks.add wbknew.saveas "z:\data\namafilebaru.xlsx" Kid. On Wed, Mar 28, 2012 at 21:02, ChubbyMike <the_x_mi...@yahoo.com> wrote: > ** > > > ** Hi kid, code yg kamu berikan itu berjalan dengan sempurna, > Boleh nanya 1 lg ga? > Dalam macro yg sy buat itu membuat 1 workbook baru lg(file c), dari tadi > saya coba otak atik. > Kalau vfile dibawah itu artinya file yg dipilih sm user, gmn cara membuat > vfile itu adalah workbook yg kita buat baru. > Sent from my BlackBerry yg belum lunas > ------------------------------ > *From: * "Kid Mr." <mr.nm...@gmail.com> > *Sender: * belajar-excel@yahoogroups.com > *Date: *Wed, 28 Mar 2012 17:11:49 +0700 > *To: *<belajar-excel@yahoogroups.com> > *ReplyTo: * belajar-excel@yahoogroups.com > *Subject: *Re: [belajar-excel] membuat workbook baru dan menjalankan > macro di workbook tersebut > > > > Mungkin begini : > > Dim vFile As Variant > Dim wbkFile As Workbook > vFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls") > If LenB(vFile) <> 0 Then > Set wbkFile = Workbooks.Open(vFile) > End If > > Kemudian semua kegiatan di file B bisa dilakukan dengan memanggil object > wbkFile > Misal : > wbkfile.activate > wbkfile.sheets(1).activate > wbkfile.sheets(1).range("d3:h19,z55:ab77").clearcontents > > Kid. > > On Wed, Mar 28, 2012 at 16:52, Chubby Mike <the_x_mi...@yahoo.com> wrote: > >> ** >> >> >> hi all, >> >> tolong bantuannya membuat macro seperti judul diatas dong. >> >> deskripsi : >> saya mau membuat commandbutton (di file A) yg jika diklik, user harus >> memilih file excel (file b) dimana macro akan berjalan di file A tersebut. >> >> saya sudah coba >> >> newfile = application.getopenfilename(filefilter:="Excel Files >> (*.xls),*.xls", title:="please select a file") >> >> tapi sayangnya macro saya berjalan di file A sehingga terjadi error. >> >> bagaimana cara membuat file B menjadi aktif setelah dibuat >> >> thanks in advance >> Mike >> >> > >