Code:
Dim objExcel As Excel.Application
Dim objWrkBk As Excel.Workbook
Dim objSheet As Excel.Worksheet
Dim strFilename As String
Dim strExcelFileName As String
Dim intResp As Integer
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.OpenText FileName:=App.Path & "/" & "StandardHmeLabelsRep.csv", Origin:=xlWindows, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlTextQualifierDoubleQuote, ConsecutiveDelimiter:=False, _
Tab:=False, Semicolon:=True, Comma:=False, Space:=False, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1))
strExcelFileName = App.Path & "\LabelsStandardReport.xls"
If Dir(strExcelFileName) <> "" Then
intResp = MsgBox(strExcelFileName & " already exists, do you wish to overwrite this file?", vbQuestion + vbYesNoCancel, "FIFG - separation")
If intResp = vbNo Then
comGetFile.ShowOpen
strExcelFileName = comGetFile.FileName
If strExcelFileName = "" Or IsNull(strExcelFileName) Then
objExcel.Workbooks.Close
objExcel.Quit
Set objExcel = Nothing
MsgBox "You have cancelled the Actual Paid report!", vbInformation + vbOKOnly
g_ShowGlass False
Exit Sub
End If
ElseIf intResp = vbYes Then
Kill strExcelFileName
ElseIf intResp = vbCancel Then
objExcel.Workbooks.Close
objExcel.Quit
Set objExcel = Nothing
MsgBox "You have cancelled the Actual Paid report!", vbInformation + vbOKOnly
g_ShowGlass False
Exit Sub
End If
End If
objExcel.ActiveWorkbook.SaveAs FileName:=strExcelFileName, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
objExcel.Workbooks.Open strExcelFileName
objExcel.Worksheets.Add
objExcel.Workbooks.OpenText FileName:=App.Path & "/" & "StandardExpLabelsRep.csv", Origin:=xlWindows, StartRow:=1, _
DataType:=xlDelimited, TextQualifier:=xlTextQualifierDoubleQuote, ConsecutiveDelimiter:=False, _
Tab:=False, Semicolon:=False, Comma:=True, Space:=False, Other:=False, _
FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1))
'
' objExcel.ActiveWorkbook.SaveAs FileName:=strExcelFileName, FileFormat:= _
' xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
' , CreateBackup:=False
objExcel.Workbooks.Close
objExcel.Quit
Set objExcel = Nothing
I can place the first csv file fine and create a new worksheet, but how do I place the second csv file onto the newlyt created worksheet?