We use cell.getContents to read the values of a cell, the content contains data (e.g. 10.2327), the data gets read as "10.233". Not sure why we are unable to read the string as it is
ok im trying to upload this csv file onto my table in pgsql
but im getting this error
ERROR: invalid input syntax for integer: "mlname,mfname,slname,sfname,address,postalcode,membershiptype,hphone,email"
CONTEXT: COPY members2, line 1, column id: "mlname,mfname,slname,sfname,address,postalcode,membershiptype,hphone,email"
i really understand why im getting this error, both my table and my csv file have the same column names
I have 2 worksheets, one with company data and the other with a min max and answer column.
What i need to do is find out if value in column D in the company data is between the min/max in worksheet 2 output answer in worksheet 2.
Please can someone help. This is clearly a vlookup question but i haven't got a clue how to do the min/max.
Any help will be greatly appreciated.
worksheet 1
NAME TYPE NUMBEROFEMPLOYEES Output
Wetland Plants Ltd Client 4
Capital Management LLP Clients 3
College ltd Clients 156
Worksheet 2
max min output
100000000 60000 big
59999 15000 medium
14999 0 small
Cheers guys
I need to install the ExcelPackage library on Visual Studio 2008. The .zip file I downloaded from their website (http://excelpackage.codeplex.com) contains a .dll, a .xml file, a "GacReg.exe" and a file called ExcelPackage (with this description: "Program Debug Database"). What are the steps to installing this library, or any library in general? I appreciate the help.
in what way can this be programmed.
a UI box that displays random number between min and max value for 2 seconds then shows blank for 2 seconds then shows another random numer for 2 seconds then shows blank for 10 seonds and then repeats the cycle infitely until form closed. Font of the text to be configurable.
any help at all will be appreciated.
How would I code a IF statement if I was trying to say
IF the date today is equal to Monday THEN
Have Outlook prepare 3 emails
ELSE
Have Outlook prepare 2 emails
END IF
I just need help setting up the "IF the date today is equal to Monday." How would that code look.
i need to write a vba script that will find a file. the file could be in three different locations
how do i find where the file is?
the file must have a specific string as part of the file name
my file name could be 9424.bas or 9424a.esy or 9424_.bas or 9424...esy, i dotn know what the file name exactly is but i know the important characters 9424
I have a CSV file. The first row will always contain column headers. Depending on a variety of factors, the order of columns may change and, in rare circumstances, some columns may not be present. These changes are beyond my control.
My thoughts, so far, on how to address this. I'll read the first row of the file and use the values to generate a list of columns contained in the source file. The destination file will use the same column names as the source. This should be as simple as searching for identical names in the source and destination, then just mapping the column index values, right?
What are your recommendations for handling this?
Dim r as Range
Set r = Range("C2:D3")
Dim r1 as Range, r2 as Range
Set r1 = r.EntireColumn
Set r2 = r.Columns
Won't both ranges represent the range "C:D"? What is the difference between the two?
When I added the JExcelAPI http://jexcelapi.sourceforge.net/ to the
class path and run my app, I get:
trouble writing output: shouldn't happen
[2009-07-16 14:32:19 - xxx] Conversion to Dalvik format failed with
error 2
any idea?
thanks
I'm currently trying to search directories for any file labelled "??.??.????.xls" (for mm.dd.yyyy.xls). The problem I have is that the code I'm using also matches filenames such as "my-restaurant.12.01.2006.xls". I only want to match filenames with specifically the notation I used above.
Dim Invoices As FileSearch
Set Invoices = Application.FileSearch
With Invoices
.Filename = "??.??.????.xls"
' invDir is a directory I chose earlier on
.LookIn = invDir
.SearchSubFolders = True
.MatchTextExactly = True
End With
Is there something I'm missing? I know I could do yet another check in my code elsewhere to make sure the filename's length is 14 characters, but is there a parameter I'm not considering in the FileSearch?
Hi,
My problem is the following:
The function below triggers an "if then function" when i manually change the value in cell D9. What should I do to get it to work with an automatic value change of cell D9 trough a link.
In other words if i where to link cell D9 to cell A1 and change the value of A1 can i still make the function below work?
Thanks in advance
Private Sub Worksheet_Change(ByVal Target As range)
If Target.Address = "$D$9" Then
If range("C12") = 0 Then
Rows("12:12").Select
Selection.RowHeight = 0
Else:
Rows("12:12").Select
Selection.RowHeight = 15
End If
End Sub
I am trying to do a simple subquery join in Microsoft Query, but I cannot figure out the syntax. I also cannot find any documentation for the syntax.
How would I write the following query in Microsoft Query?
SELECT *
FROM (
SELECT Col1, Col2
FROM `C:\Book1.xlsx`.`Sheet1$`
) AS a
JOIN (
SELECT Col1, Col3
FROM `C:\Book1.xlsx`.`Sheet1$`
) AS b
ON a.Col1 = b.Col1
Is there official documentation for Microsoft Query?
Thanks!
I've downloaded PHPExcel 1.7.5 Production.
I would like to use setReadDataOnly() and enableMemoryOptimization() as discussed in their forum here and in stackoverflow questions.
However when I use them, I get a Call to undefined method error.
Is there another version or some plugin or library that I have not installed?
What do I have to do to access these methods?
$objPHPExcel = PHPExcel_IOFactory::load("data/".$file_name);
$objPHPExcel->setReadDataOnly(true); //Call to undefined method
$objPHPExcel->enableMemoryOptimization(); //Call to undefined method
Sub something(tecan)
On Error Resume Next
Dim arr As New Collection, a
Dim aFirstArray() As Variant
Dim i As Long
aFirstArray() = Array(Dir(tecan & "*.ESY", vbNormal))
aFirstArray(0) = Mid(aFirstArray(0), 1, 4)
Do While Dir <> ""
ReDim Preserve aFirstArray(UBound(aFirstArray) + 1)
aFirstArray(UBound(aFirstArray)) = Mid(Dir, 1, 4)
Loop
On Error Resume Next
For Each a In aFirstArray
arr.Add a, a
Next
For i = 1 To arr.Count
Cells(i, 1) = arr(i)
'open_esy (tecan & arr(i) & "*")
Next
Erase aFirstArray
For i = 1 To arr.Count
arr.Remove i
Next i
here is how i call this sub:
something (tecan1)
something (tecan2)
on the first call it works and does what it is supposed to
but on the second call it gets stuck in this loop:
Do While Dir <> ""
ReDim Preserve aFirstArray(UBound(aFirstArray) + 1)
aFirstArray(UBound(aFirstArray)) = Mid(Dir, 1, 4)
Loop
why does it get stuck in the loop?
I have a non-contiguous range on rows (example address of myRange: $2:$2,$4:$205,$214:$214) and I would like to access a specific row and column within the range. I have tried the following:
'Get the value of the 2nd row, 1st column within the range
myRange.rows(2).Cells(, 1).Value
However, this is giving me the value of the 2nd row in the WorkSheet, and NOT in the range - meaning it is giving me address $3$1 - and not $4$1
Can someone please explain how I can access the values within in my range? (It may have to do with different areas)
Thank You
hi,
I need to trigger(return) an error event from a VBA function, then the calling function of this function can trigger On Error Go to call.
E.g
function Test()
On Error Go to myError:
TestErr()
Exit Function
myerror:
Test = "Error Triggered"
End Function
Function TestErr()
?? 'How to Trigger error here
End Function
Thank You
Is Infragistics.Excel V 10.1(Latest) compatible with Visual studio 2005 and .net clr 2.0?
Is there any service pack associated with Infragistics.Excel V 10.1 for fixes associated with excel macro?
If so how to get that?
Please help :-(
I am using XLSX2CSV example to parse large sheets from a workbook. Since I only need to output the data for specific sheets I added an if statement in the process method to test for the specific sheets. When the condition is met I continue with the process.
public void process()
throws IOException, OpenXML4JException, ParserConfigurationException, SAXException {
ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(this.xlsxPackage);
XSSFReader xssfReader = new XSSFReader(this.xlsxPackage);
StylesTable styles = xssfReader.getStylesTable();
XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) xssfReader.getSheetsData();
while (iter.hasNext()) {
InputStream stream = iter.next();
String sheetName = iter.getSheetName();
if (sheetName.equals("SHEET1")||sheetName.equals("SHEET2")||sheetName.equals("SHEET3")||sheetName.equals("SHEET4")||sheetName.equals("SHEET5")){
processSheet(styles, strings, stream);
try {
System.setOut(new PrintStream(
new FileOutputStream("C:\\Users\\edennis.AD\\Desktop\\test\\"+sheetName+".txt")));
} catch (Exception e) {
e.printStackTrace();
}
stream.close();
}
}
}
But I need to output text file and not sure how to do it. I tried to use the System.set() method to output everything from system.out to text but that's not working I just get blank files.
I have the following VBA code:
Option Explicit
Private a(2) as Double
Private b(2) as Double
Public Function Hello(X1 As Double, X2 As Double) As Double
a(1) = X1 + X2
a(2) = X1/X2
b(1) = X1
b(2) = X2^2
Hello = a(1)+a(2)+b(1)+b(2)
End Function
Within the function Hello I have defined a(1),a(2),b(1),b(2).
However, I want to make some function or sub-routine that accepts X1 and X2 as arguments and spits out the values for a(1),a(2),b(1),b(2). This is because I use the above definitions for a(1),a(2),b(1),b(2) in about 20 functions in my module and would like to avoid having to do the following in each function that I use thesis in:
a(1) = X1 + X2
a(2) = X1/X2
b(1) = X1
b(2) = X2^2
For a VSTO workbook project, is there a best practice for retrieving a reference to the Ribbon object from the ThisWorkbook class?
Here's what I'm doing: In my Ribbon class, I created a public method called InvalidateControl(string controlID). I need to call that method from the ThisWorkbook class based on when a certain workbook level event fires. But the only way I can see to "get" a reference to that Ribbon object is to do this...
// This is all in the ThisWorkbook class
Ribbon ribbon;
protected override IRibbonExtensibility CreateRibbonExtensibilityObject()
{
this.ribbon = new Ribbon();
return this.ribbon;
}
...which seems a little smelly. I mean, I have to override CreateRibbonExtensibilityObject() regardless; all I'm doing beyond that is maintaining a local reference to the ribbon so I can call methods against it. But it doesn't feel right. Is there another, better way to get that reference in the ThisWorkbook class? Or is this pretty acceptable?
Thanks!
I wrote the following section:
Function find_results_idle()
Public iRaw As Integer
Public iColumn As Integer
iRaw = 1
iColumn = 1
and i get the error messege:
"invalid attribute in Sub or Function"
do you know what i did wrong?
i tried instead of "Public" to use "Global" but got the same problem.
I tird to declare the function itself as "Public" but no good...
what do i do wrong?
thanks.
I've added some form controls to a collection and can retrieve their properties when I refer to the members by index.
However, when I try to use any properties by referencing members of the collection I see a 'Could not set the ControlSource property. Member not found.' error in the Locals window.
Here is a simplified version of the code:
'Add controls to collection'
For x = 0 To UBound(tabs)
activeTabs.Add Item:=Form.MultiPage.Pages(Val(tabs(x, 1))), _
key:=Form.MultiPage.Pages(Val(tabs(x, 1))).Caption
Next x
'Check name using collection index'
For x = 0 To UBound(tabs)
Debug.Print "Tab name from index: " & activeTabs(x + 1).Caption
Next x
'Check name using collection members'
For Each formTab In activeTabs
Debug.Print "Tab name from collection: " & formTab.Caption
Next formTab
The results in the Immediate window are:
Tab name from index: Caption1
Tab name from index: Caption2
Tab name from collection:
Tab name from collection:
Why does one method work and the other fail?
This is in a standard code module, but I have similar code working just fine from within form modules. Could this have anything to do with it?