Edit existing excel file

  • Thread starter Thread starter Katrina
  • Start date Start date
K

Katrina

I have an export module set up that creates a new excel
worksheet and adds information to it. In setting up the
module, I have the following varibles (actually objects)
defined.

Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Add
Set xlWs = xlWb.Worksheets("Sheet1")

I have the 3 variables called out later. I tryed using
the "GetObject" function, but then when I tried to define
xlWb and xlWs, the programs gave me errors saying that
the property wasn't supported...

How do I call up an exisiting workbook and call out a
specific sheet so that I can reference cells later as
seen below?

xlWs.cells(1, 1).Value = "Start of Page"

Thanks,
Katrina
 
I have an export module set up that creates a new excel
worksheet and adds information to it. In setting up the
module, I have the following varibles (actually objects)
defined.

Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Add
Set xlWs = xlWb.Worksheets("Sheet1")

I have the 3 variables called out later. I tryed using
the "GetObject" function, but then when I tried to define
xlWb and xlWs, the programs gave me errors saying that
the property wasn't supported...

How do I call up an exisiting workbook and call out a
specific sheet so that I can reference cells later as
seen below?

xlWs.cells(1, 1).Value = "Start of Page"

Thanks,
Katrina

This works for me:

Dim xlApp As Excel.Application
Dim xlWorkbook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Set xlApp = CreateObject("Excel.Application")
Set xlWorkbook = xlApp.Workbooks.Add
Set xlSheet = xlWorkbook.Sheets(1)
xlSheet.Cells(1, 1).Value = "Success!!!"
xlApp.Visible = True

Set xlApp = Nothing
Set xlWorkbook = Nothing
Set xlSheet = Nothing
 
That code works for me also, but it doesn't do what I'm
looking for. I want to open an exisiting excel file and
edit it, not create a new one.

Any further suggeestions?

Katrina
 
Back
Top