473,378 Members | 1,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Excel add-in opentext method

Hi, i'm trying to code my first add-in, which should open file selected by
user (txt file, space delimited), do some formatting, calculation and pivot
table at the end. My problem is, that I can't see opened workbook. Here is
my code:

Public Class Connect
Dim applicationObject as Object

//creating toolbar with buttons, it's all right, button click event calls
//sub Lista

Private Sub Lista()
Dim objFileDialogOpen As FileDialog
objFileDialogOpen = applicationObject.FileDialog(msoFileDialogOpen)
With objFileDialogOpen
.AllowMultiSelect = False
.Title = "Open Prodstar File ..."
.Filters.Clear()
.Filters.Add("Prodstar File", "*.lis")
.InitialView = msoFileDialogViewList
.Show()
End With

Dim myApp As Excel.ApplicationClass
myApp = New Excel.ApplicationClass
Dim myWrkb As Excel.Workbooks
Dim myArray(,) As Object = {{0, 1}, {12, 2}, {27, 2}, {35, 4}, {44, 1}, _
{63, 1}, {80 , 1}, {99, 1}, {118, 1}, {122, 2}, {153, 4}}
myApp.Workbooks.OpenText(FileName:=objFileDialogOp en.Item _
, Origin:=852, StartRow:=1, DataType:=xlFixedWidth, Space:=True,
FieldInfo:=myArray _
, TrailingMinusNumbers:=True)
myWrkb = myApp.ActiveWorkbook

//additional code
End Sub

How can I force Excel to show me imported file? And why, when I write
objFileDialogOpen.SelectedItem(1) in OpenText method, IDE is saying, that
SelectedItems is not indexed because it has no default property, even if
it's collection.

TIA
--
Przemek
Now playing: "Iron Maiden - Fear Of The Dark"
Jul 25 '05 #1
0 1167

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

Similar topics

0
by: Nick Carter | last post by:
The following C# lines of code work fine with Excel 2000:- ExcelApplication excelApplication = new Excel.Application(); ExcelWorkbook excelWorkbook =...
5
by: touf | last post by:
Hi, I've an error when I declare Dim oBook As Excel.Workbooks What imports, and reference do I need to use Excel.Workbooks class? Thanks
4
by: msnnews.msn.com | last post by:
hi there, i've got a form that populates a datagrid, and a button that calls a function to export to an excel file. All is well with the export, no errors are returned, but the Excel instance...
1
by: Steven | last post by:
Hello, I use the following code to make an Excel-file, which works fine with Excel 2003 (and the MS Excel 11.0 object library): Dim Excel As New Excel.Application Dim oBook As...
2
by: John Walker | last post by:
Hello, Below is my code for exporting a datagrid to Excel. It works fine, but we're going to need to somehow have a report header, user input parameters and system date display at the top of the...
2
by: John Walker | last post by:
Hello, Below is my code for exporting a datagrid to Excel. It works fine, but we're hoping to format the output as well - setting the font size and type, and giving each column a specific width,...
4
by: jmalvika | last post by:
Hi all, I'm trying to generate an excel report from an ASP web page using .. "response.ContentType = "application/vnd.ms-excel" .... I need to add a custom header & footer to the excel...
0
by: strider | last post by:
I have struggled with this problem and the solution is that you have to declare a variable for each and every object or collection within the Excel application that you want to use: For example:...
1
by: DennisBetten | last post by:
First of all, I need to give some credit to Mahesh Chand for providing me with an excellent basis to export data to excel. What does this code do: As the title says, this code is capable of...
3
by: JFKJr | last post by:
Hello everyone, the following is the code which opens an excel file and creates a toolbar button. And, when I click the toolbar button as shown at line #28, the code should call the "Example"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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 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.