Click here to Skip to main content
15,922,894 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Wait for Shell script to finish Pin
MartyK200714-Sep-07 4:51
MartyK200714-Sep-07 4:51 
QuestionAnyone out there try TrSpeaker add in component in vb6? Pin
Robert from Florida13-Sep-07 5:55
Robert from Florida13-Sep-07 5:55 
AnswerRe: Anyone out there try TrSpeaker add in component in vb6? Pin
Dave Kreskowiak13-Sep-07 6:04
mveDave Kreskowiak13-Sep-07 6:04 
QuestionExcel automation problem Pin
Alsvha13-Sep-07 5:03
Alsvha13-Sep-07 5:03 
AnswerRe: Excel automation problem Pin
Dave Kreskowiak13-Sep-07 5:28
mveDave Kreskowiak13-Sep-07 5:28 
GeneralRe: Excel automation problem Pin
Alsvha13-Sep-07 9:32
Alsvha13-Sep-07 9:32 
GeneralRe: Excel automation problem Pin
Dave Kreskowiak13-Sep-07 9:52
mveDave Kreskowiak13-Sep-07 9:52 
GeneralRe: Excel automation problem Pin
Alsvha13-Sep-07 19:08
Alsvha13-Sep-07 19:08 
With mObjExcel<br />
 .CreateRange(.GetExcelColumnName(EnuColumn.UnitPrice + mIntColumnCountFactor) & mIntColRow(intCounter) & ":" & .GetExcelColumnName(EnuColumn.UnitPrice + mIntColumnCountFactor) & mIntColRow(intCounter), mStrSheetNames(intCounter))<br />
 .CellRange.NumberFormat = "#.##0"<br />
 .CellRange.Formula = "=SUM(" & strFormular & ")"<br />
 .CellRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, , mObjBlack.ToInteger)<br />
End With


The "GetExcelColumnName" is a function which just returns the Excel Column name such as A1, B2 based on a column and row number. Nothing special - just one I made to help myself.

The strFormula variable is the formula mentioned which looks like 'Sheetname!Cell;Sheetname!Cell' and is build dynamically based on which actual sheetnames and cells are used.
The formula works when I copy it into the generated excel document so there is not a problem with the formula as such. Just the generation of it automatically

Inside my mObjExcel the CreateRange looks like

  <br />
Friend Sub CreateRange(ByVal range As Object, ByVal strSheetName As String)<br />
  SetCultureFixStart() ''Changes the current Culture to en-US, casue otherwise excel automation crashes<br />
  If Not mObjCells Is Nothing Then ReleaseComObject(mObjCells)''cleans up COM objects which might linger in memory<br />
  mObjCells = Nothing ''cleans up COM objects which might linger in memory<br />
  System.GC.Collect() ''cleans up COM objects which might linger in memory<br />
  mObjCells = mObjSheets(strSheetName).Range(range).Cells<br />
  SetCultureFixEnd() ''sets culture back<br />
End Sub


And CellRange is just a property which returns my mObjCells (which is an Excel.Range).


What strikes me as most annoying is that the above code works when I use 1+1 in the formula instead of Sheetnames!cell, or when I post out more complex formulas, even .FormulaArray work.
So basically so far, I've been able to do all I wanted to, except use Sheetnames in a formula :/

Thanks so far for the feedback/time.

---------------------------
127.0.0.1 - Sweet 127.0.0.1

GeneralRe: Excel automation problem - Simple Example Pin
Alsvha13-Sep-07 21:28
Alsvha13-Sep-07 21:28 
GeneralRe: Excel automation problem - Simple Example Pin
Alsvha13-Sep-07 22:09
Alsvha13-Sep-07 22:09 
GeneralRe: Excel automation problem - Simple Example Pin
Dave Kreskowiak14-Sep-07 4:51
mveDave Kreskowiak14-Sep-07 4:51 
GeneralRe: Excel automation problem Pin
Luc Pattyn13-Sep-07 9:57
sitebuilderLuc Pattyn13-Sep-07 9:57 
GeneralRe: Excel automation problem Pin
Alsvha13-Sep-07 19:10
Alsvha13-Sep-07 19:10 
QuestionDataGrid Pin
Kiran Pinjala13-Sep-07 3:07
Kiran Pinjala13-Sep-07 3:07 
AnswerRe: DataGrid Pin
Dave Kreskowiak13-Sep-07 4:50
mveDave Kreskowiak13-Sep-07 4:50 
QuestionHow to change the owner of a registry key ? Pin
Ky Nam13-Sep-07 3:04
Ky Nam13-Sep-07 3:04 
AnswerRe: How to change the owner of a registry key ? Pin
Dave Kreskowiak13-Sep-07 4:42
mveDave Kreskowiak13-Sep-07 4:42 
QuestionHow can i invoke javascript functions in vb .net? Pin
eyes200713-Sep-07 2:53
eyes200713-Sep-07 2:53 
AnswerRe: Pdf to text Pin
WhiteGirl2313-Sep-07 2:07
WhiteGirl2313-Sep-07 2:07 
QuestionPdf to text Pin
Prakash_Mishra13-Sep-07 0:41
Prakash_Mishra13-Sep-07 0:41 
Questionrejoining split lines Pin
Mustafa Ismail Mustafa13-Sep-07 0:30
Mustafa Ismail Mustafa13-Sep-07 0:30 
AnswerRe: rejoining split lines Pin
Dave Kreskowiak13-Sep-07 4:34
mveDave Kreskowiak13-Sep-07 4:34 
QuestionHow to print Crystal report directly Pin
Swiss Mantoro12-Sep-07 22:28
Swiss Mantoro12-Sep-07 22:28 
AnswerRe: How to print Crystal report directly Pin
Steven J Jowett12-Sep-07 23:47
Steven J Jowett12-Sep-07 23:47 
QuestionUpdate Date Pin
TAK7812-Sep-07 12:11
TAK7812-Sep-07 12:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.