473,769 Members | 5,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft.Offic e.Interop.Excel Texttocolumns C#

I am new to C# and I am trying to convert this vba code to C#:

Columns("A:A"). Select
Selection.TextT oColumns Destination:=Ra nge("A1"),
DataType:=xlDel imited, _
TextQualifier:= xlDoubleQuote, ConsecutiveDeli miter:=False,
Tab:=False, _
Semicolon:=Fals e, Comma:=True, Space:=False, Other:=False,
FieldInfo _
:=Array(Array(1 , 1), Array(2, 1), Array(3, 1), Array(4, 1),
Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1), Array(10, 1), Array(11,
1), Array(12, 1), Array(13, 1 _
), Array(14, 1), Array(15, 1), Array(16, 1), Array(17, 1),
Array(18, 1)), _
TrailingMinusNu mbers:=True

I came up with this:

aRange = excelWorksheet. get_Range("A1",
Missing.Value);
aRange.TextToCo lumns("A1",
Excel.XlTextPar singType.xlDeli mited,
Excel.XlTextQua lifier.xlTextQu alifierDoubleQu ote,
false, false, false, true, false, false,
false, false, false, false, true);

I get an error with the range. I can find several vb examples of this
but no c# using the interop.

Thanks

Apr 6 '07 #1
0 2909

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5574
by: AllenF | last post by:
I have a library (named DSG) created in C# which other programs use to build Excel spreadsheeets. This library uses the office PIAs "Microsoft.Office.Interop.Excel.dll" and also references the Microsoft Office v10 library using ActiveX. Recently I loaded Microsoft's Project 2003 (v11) to my programming computer for tracking purposes, which loaded the Microsoft Office v11 library. Now, when I run my programs (in VS C#) I get two errors:...
8
8201
by: | last post by:
Hi All, I'm tring to write an application which open .xls files and get information from them ( using .xls file as a database ). According to the MSDN ( http://support.microsoft.com/default.aspx?scid=kb;EN-US;302094 ) I must add Microsoft Excel Object Library as an reference OK It works fine ... but when I place the line
6
1976
by: ©pEIO | last post by:
I have installed the PIA of Microsoft Office 2003 and the installation was succefully. If I add the reference of Microsoft Excel 11.0, I see that the property CopyLocal is False and the assembly linked is C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\11.0.0.0__71e9bce111e 9429c\Microsoft.Office.Interop.Excel.dll But if I try to use the the assembly, I see that the object Range are
3
10791
by: ©pEIO | last post by:
Example: Dim xlsExcel As Excel.Application Dim wkbExcel As Excel.Workbook Dim wksExcel As Excel.Worksheet xlsExcel = New Excel.Application wkbExcel = xlsExcel.Workbooks.Open("C:\Test.xls") wksExcel = wkbExcel.Worksheets(i)
2
11477
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability, where, after adding a reference to Microsoft.Office.Core and a reference to Microsoft Word I declare objects as follows: Dim oWordApp As New Microsoft.Office.Interop.Word.Application, . Everything works fine on the development computer...
4
33089
by: Irfan | last post by:
hi, Two questions, i dont know if the cause if these two problems is the same. 1. As soon as i Add->Reference -> Microsoft Excel 11.0 Object library. It gives an error 'The referenced component 'Excel' could not found. I downloaded PIA from MS website this morning.After a bit of digging i found in the /assembly folder that Microoft/office/interop/excel.dll is present
5
27259
by: C# newbie with big problems | last post by:
Ok, I've tried everything I could come up with but nothing is working. I am creating an application which needs to post information into an excel document. I have not yet had a chance to play with any of the methods because I cannot pull in the Microsoft.Office.Interop.Excel class. I am using Visual c# 2005 Express as my IDE, and here what I have done so far. I open a new project and select Project->Add Reference Then I go to the...
5
49825
by: Michael Russell | last post by:
Hi all, Using C#, I've created a simple wrapper class for using Excel. I have Office Pro 2003 installed on my devel machine. The wrapper class works great, reading and writing to/from Excel. To do this, I created a reference to "Microsoft Excel 11.0 Object Library", and have a "using Excel;" directive. I decided to add a method for creating a TextBox using the Shapes.AddTextBox method, which requires a
10
5004
KodeKrazy
by: KodeKrazy | last post by:
I'm trying to read an Excel worksheet and do a find/replace for all of the commas "," in any of the cells in the sheet and replace them with a dash "-" I can get as far as getting the workbook opened but I'm not sure where to go from here. Is there a simple method to accomplish this? Below is the code I have so far: Dim exl As Microsoft.Office.Interop.Excel.Application Dim sht As...
0
9583
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10039
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5297
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3955
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.