Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.vb.ole.automation,microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Using VB6 and OLE to add a new column to an existing Excel worksheet

Greetings,

Is it possible to programmatically add a new column to an existing
Excel worksheet using VB 6.0 and OLE? Or VB 6.0 and ??? It's OK if the
added column becomes the new "A" column and shifts all previously
existing columns over one. I 'haven't been able to google up any
coding examples that do this. Examples are always welcome.

TIA,

Steve

  #2   Report Post  
Posted to microsoft.public.vb.ole.automation,microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Using VB6 and OLE to add a new column to an existing Excel worksheet

Sub addcolum()
Dim xlApp As Object
Dim xlWB As Object
Dim xlWS As Object

Set xlApp = CreateObject("Excel.Application")
Set xlWB = xlApp.Workbooks.Open("C:\myDir\myBook.xls") '<=== change to
suit
Set xlWS = xlWB.Worksheets(1)
xlWS.Columns(1).Insert

Set xlWS = Nothing
Set xlWB = Nothing
xlApp.Quit
Set xlApp = Nothing

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Greetings,

Is it possible to programmatically add a new column to an existing
Excel worksheet using VB 6.0 and OLE? Or VB 6.0 and ??? It's OK if the
added column becomes the new "A" column and shifts all previously
existing columns over one. I 'haven't been able to google up any
coding examples that do this. Examples are always welcome.

TIA,

Steve



  #3   Report Post  
Posted to microsoft.public.vb.ole.automation,microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Using VB6 and OLE to add a new column to an existing Excel worksheet

Thanks that seems to have worked. I mean, my app now runs to completion
without errors and does create a new .xls - but I can't open it with
Excel to view it!! Any idea what could cause this behavior?

Thanks for your previous help!


Steve

  #4   Report Post  
Posted to microsoft.public.vb.ole.automation,microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Using VB6 and OLE to add a new column to an existing Excel worksheet

can you clarify what you mean, detail the steps that you took.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Thanks that seems to have worked. I mean, my app now runs to completion
without errors and does create a new .xls - but I can't open it with
Excel to view it!! Any idea what could cause this behavior?

Thanks for your previous help!


Steve



  #5   Report Post  
Posted to microsoft.public.vb.ole.automation,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using VB6 and OLE to add a new column to an existing Excel worksheet


wrote in message
oups.com...
Greetings,

Is it possible to programmatically add a new column to an existing
Excel worksheet using VB 6.0 and OLE? Or VB 6.0 and ??? It's OK if the
added column becomes the new "A" column and shifts all previously
existing columns over one. I 'haven't been able to google up any
coding examples that do this. Examples are always welcome.

TIA,

Steve


Check here, maybe this is what you are asking for:
http://support.microsoft.com/kb/285332

Check References within that article for more links.

Dmitriy.




  #6   Report Post  
Posted to microsoft.public.vb.ole.automation,microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Using VB6 and OLE to add a new column to an existing Excel worksheet


"Dmitriy Antonov" wrote in message
...

wrote in message
oups.com...
Greetings,

Is it possible to programmatically add a new column to an existing
Excel worksheet using VB 6.0 and OLE? Or VB 6.0 and ??? It's OK if the
added column becomes the new "A" column and shifts all previously
existing columns over one. I 'haven't been able to google up any
coding examples that do this. Examples are always welcome.

TIA,

Steve


Check here, maybe this is what you are asking for:
http://support.microsoft.com/kb/285332

Check References within that article for more links.

Dmitriy.


Oops. I accidentally misplaced my reply. It applies to another post (the
one, which is just above it) - so please disregard it here.

Dmitriy.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add a worksheet to an existing EXCEL file? Dex640 Excel Worksheet Functions 3 December 30th 08 10:09 PM
How do I place column headings in an existing worksheet in Excel? Donna Dionne Excel Discussion (Misc queries) 3 April 22nd 07 04:32 PM
When I open a an existing excel worksheet, it duplicates itself a. Gotoperson Excel Discussion (Misc queries) 4 July 16th 06 11:35 AM
can not add data to existing Excel worksheet sullyhd Excel Discussion (Misc queries) 1 May 2nd 05 06:01 PM
Overwriting existing data in an Excel worksheet using ADO.Net Joel Gordon Excel Programming 6 December 2nd 04 08:34 AM


All times are GMT +1. The time now is 10:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"