English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have made a program using msexcel and was able to apply its visual basic. This program uses mainly of excel operation, excel worksheets and its operations like formulas, ranges, etc. I learned visual basic actually through studying macros that I'd recorded.

But I don't know how to manipulate them when I am using the standard visual basic (6).

How can I at least open the excel application using the standard VB (not the one that comes with ms excel)? I mean of code.

Thanks much.

2007-08-28 16:00:18 · 1 answers · asked by Ugly Pig 1 in Computers & Internet Programming & Design

1 answers

Hi,
When u open VBA in MS-Excel, it has objects of worksheet already available, and ur workbook is already open.

If u want to manipulate ur worksheet through VB(6), U will have to include MS-Excel object library. For this go to main menu and select Project->References, there is a list of references, u select MS-Excel object library 11.0 and press OK.
Suppose ur excel file is C:\abc.xls and u want to manipulate sheet1, then write the code in some Subroutine
----------------------------------------------------------------------
dim wrkbook as workbook,sheet1 as worksheet
set wrkBook=workbooks.open("C:\abc.xls")
set Sheet1=wrkbook.sheets(1)
----------------------------------------------------------------------
now u can access ur excel worksheet by name Sheet1
with sheet1 u can use ur code, that u written in VBA.
when the subroutine ends, u write
wrkbook.save
wrkbook.close

2007-08-29 00:29:43 · answer #1 · answered by iqbal 4 · 0 0

fedest.com, questions and answers