I have been trying to use the following code and Visual
Basic.NET does not seem to recognize "xlDelimited"
and "xlDoubleQuote". Do I need to do something to get
the software to recognize these Excel constants?
Thanks,
Lee
Dim app as Excel.Application
Dim strFileName as String
app = CType(CreateObject("Excel.Application"), _
Excel.Application)
OpenFileDialog1.Filter = "Data (*.txt)|*.txt"
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
strFileName = OpenFileDialog1.FileName
book = app.Workbooks.OpenText(strFileName, _
Origin:=437, StartRow:=1, DataType:=xlDelimited,
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=True, Space:=True)
app.Visible = True
End If 5 5617
"Lee" <an*******@discussions.microsoft.com> schrieb I have been trying to use the following code and Visual Basic.NET does not seem to recognize "xlDelimited" and "xlDoubleQuote". Do I need to do something to get the software to recognize these Excel constants? Thanks, Lee
Dim app as Excel.Application Dim strFileName as String app = CType(CreateObject("Excel.Application"), _ Excel.Application) OpenFileDialog1.Filter = "Data (*.txt)|*.txt" If OpenFileDialog1.ShowDialog = DialogResult.OK Then strFileName = OpenFileDialog1.FileName book = app.Workbooks.OpenText(strFileName, _ Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=True, Space:=True) app.Visible = True End If
Use the qualified name instead:
Excel.XlTextParsingType.xlDelimited
You might also consider importing Excel or Excel.XlTextParsingType.
To understand name resolution: http://msdn.microsoft.com/library/en...fVBSpec4_7.asp
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Armin,
I appreciate your help but that doesn't seem to solve my
problem. What I am trying to do is open an ASCII data
file in Excel that is space delimited. My problem seems
to be understanding how the OpenText method works in
Excel. I can import the data file into Excel with the
Open method but that will not allow me to set up for
space delimited data. Do you have any idea how to do
this?
Thanks,
Lee -----Original Message----- "Lee" <an*******@discussions.microsoft.com> schrieb I have been trying to use the following code and
Visual Basic.NET does not seem to recognize "xlDelimited" and "xlDoubleQuote". Do I need to do something to get the software to recognize these Excel constants? Thanks, Lee
Dim app as Excel.Application Dim strFileName as String app = CType(CreateObject("Excel.Application"), _ Excel.Application) OpenFileDialog1.Filter = "Data (*.txt)|*.txt" If OpenFileDialog1.ShowDialog = DialogResult.OK Then strFileName = OpenFileDialog1.FileName book = app.Workbooks.OpenText(strFileName, _ Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _ ConsecutiveDelimiter:=True, Space:=True) app.Visible = True End If
Use the qualified name instead: Excel.XlTextParsingType.xlDelimited
You might also consider importing Excel or
Excel.XlTextParsingType. To understand name resolution: http://msdn.microsoft.com/library/en-
us/vbls7/html/vblrfVBSpec4_7.asp
-- Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
.
"Lee" <hu*********@pacbell.net> schrieb Armin, I appreciate your help but that doesn't seem to solve my problem.
You wrote that the problem is that the compiler does not recognize
xlDelimited and other constants. My reply does not answer this question?
What I am trying to do is open an ASCII data file in Excel that is space delimited. My problem seems to be understanding how the OpenText method works in Excel. I can import the data file into Excel with the Open method but that will not allow me to set up for space delimited data. Do you have any idea how to do this?
I think this is not the problem you asked in the first posting. As you have
opened a new thread about this problem, I'll try to answer there.
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Hi Armin,
I'm sorry if I have confused you but I am very new to the
user's group here. Actually, I posted another question as
you noticed, but they are really the same problem. I am
trying to use the OpenText method with an Excel.Workbooks
object and I kept getting the blue underline when I use
xlDelimited in the argument for the OpenText method.
I tried your suggestion but the software tells
me "Expression does not produce a value" for the first
argument of the CType function. I guess I don't know
enough to solve the problem as you suggested.
Regards,
Lee -----Original Message----- "Lee" <hu*********@pacbell.net> schrieb Armin, I appreciate your help but that doesn't seem to solve my problem. You wrote that the problem is that the compiler does not
recognizexlDelimited and other constants. My reply does not answer
this question? What I am trying to do is open an ASCII data file in Excel that is space delimited. My problem seems to be understanding how the OpenText method works in Excel. I can import the data file into Excel with the Open method but that will not allow me to set up for space delimited data. Do you have any idea how to do this? I think this is not the problem you asked in the first
posting. As you haveopened a new thread about this problem, I'll try to
answer there.
-- Armin
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
.
"Lee" <le********@lumileds.com> schrieb im Newsbeitrag
news:03****************************@phx.gbl... Hi Armin, I'm sorry if I have confused you but I am very new to the user's group here. Actually, I posted another question as you noticed, but they are really the same problem. I am trying to use the OpenText method with an Excel.Workbooks object and I kept getting the blue underline when I use xlDelimited in the argument for the OpenText method.
I'll answer in the other thread.
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tim Roberts |
last post by:
I've done a lot of COM work from Python, including control of the Office
applications. However, I have a question that I've never been able to
answer.
Is there a way to programmatically fetch...
|
by: Agoston Bejo |
last post by:
Hi, is there somewhere a file that holds constants for Excel Automation
ActiveX objects, such as adovbs.inc for ADO constants?
Thx
|
by: Robert Hicks |
last post by:
I need to pull data out of Oracle and stuff it into an Excel
spreadsheet. What modules have you used to interface with Excel and
would you recommend it?
Robert
|
by: deko |
last post by:
When using automation (and especially with early binding) I've heard it is
best to use explicit references to
everything. For example:
Dim xlChart as Excel.Chart
rather than
Dim objChart...
|
by: deko |
last post by:
So I've decided to convert from Early Binding to Late Binding. Now that
I've been baptized, I need some instruction in the faith.
My former ways were thus:
Dim xlapp As Excel.Application
Set...
|
by: krigare |
last post by:
Hope this is the right place to post :-)
I am trying to use an Excel COM object via PHP. I am able to read/write
data to cells, use AutoFilter, and AutoFit on columns. I can even set
the cell...
|
by: implicate_order |
last post by:
Greetings,
I'm new to python and am in the process of writing a script to parse
some CSV data, spread it across multiple Excel worksheets and then
generate charts. I searched the internet to...
|
by: Lance Hoffmeyer |
last post by:
Hi all,
I am trying to find the last used column in an excel sheet using win32com:
lastcol = sh.UsedRange.Columns.Count
works, but only if there is no formatting. I want to allow formatting...
|
by: Ally |
last post by:
Hi all,
I’m looking to plot charts in Excel from python. After some Googling
I’ve found the following code:
def plot(x, y, xAxisLog=False, yAxisLog=False):
# acquire application object, which...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |