PC Review


Reply
Thread Tools Rate Thread

Edit existing excel file

 
 
Katrina
Guest
Posts: n/a
 
      30th Jun 2004
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
 
Reply With Quote
 
 
 
 
Dan
Guest
Posts: n/a
 
      30th Jun 2004
On 6/30/2004 12:55 PM, Katrina wrote:

> 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
 
Reply With Quote
 
Katrina
Guest
Posts: n/a
 
      30th Jun 2004
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
>-----Original Message-----
>On 6/30/2004 12:55 PM, Katrina wrote:
>
>> 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
>.
>

 
Reply With Quote
 
Dan
Guest
Posts: n/a
 
      30th Jun 2004
Set xlWorkbook = xlApp.Workbooks.Open("H:\MyDir\MyFile.xls")

On 6/30/2004 3:52 PM, Katrina wrote:

> 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
>
>>-----Original Message-----
>>On 6/30/2004 12:55 PM, Katrina wrote:
>>
>>
>>>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
>>.
>>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
edit existing excel glenn.ward@e-tcc.com Microsoft VB .NET 1 9th Sep 2008 09:46 PM
Cant edit existing .doc file Dan DeCoursey Microsoft Word Document Management 1 8th May 2008 02:46 PM
Importing text file, only option to edit existing file =?Utf-8?B?c21va2V5OTk=?= Microsoft Excel Misc 8 26th Apr 2006 09:08 PM
HOW DO I EDIT AN EXISTING FILE TO BE SPACE DELIMITED? =?Utf-8?B?Y2Y=?= Microsoft Excel Misc 1 18th Feb 2005 05:29 PM
Open existing excel file and can't edit it. stoic Microsoft Excel Discussion 1 2nd Oct 2003 11:37 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:33 PM.