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"