Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Remove Page N Of M From The PageFooter While Exporting The File To Excel Sheet


Hai,
  
 The below is the area i am working

     Developing In: VB6
    Database: MsAccess 2003
    Reporting Tool: Crystal Report 9

  When i export the Report from Crystal to Excel, the page number is showin Page 1 of 15 is displayed in the PageFooter, its also added in the Excel sheet after exporting it, is it possible to avoid adding this in the excel sheet, but at the same time i don't want to remove the Page N of M from the CrystalReport.



Thank you,
Chock.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Exporting Excel Sheet To A Seperate File
Hello,

Was hoping someone could point me in the right direction... I need a program that will run once a day and scan a folder of excel files, if the files have been changed the program needs to go into the spreadsheet pull out a certain sheet only and save it as a seperate xls file.

I have never done any programming in VB for this kind of thing and do not know where to even start, any help would be greatly appreciated.

Alternativly if anyone knows of an exisiting program that will do this I would be glad to buy it!

Remove PageHeader And PageFooter In WordXp.
Hi,

I wanted to delete the PageHeader and PageFooter of a document, but couldn't google anything usefull about this property. So I recorded a macro and modified it to:

Code:

If RemoveHeaderAndFooter = True then
        ActiveDocument.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
        Selection.WholeStory
        Selection.Delete Unit:=wdCharacter, Count:=1
        ActiveDocument.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
        Selection.WholeStory
        Selection.Delete Unit:=wdCharacter, Count:=1
        ActiveDocument.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End If


I'm only wondering if this can't be done easier?! (And next to this: I still can 'see the action' even if screenupdating is turned off.)

Thanks in advance,

Chris

Exporting A Sheet From Excel
i know how to export a chart in vb using this code:
ActiveChart.Export Filename:="C:My DocumentsFILE.tif", FilterName:="TIF"

but i want to be able to export a worksheet. I change ActiveChart to ActiveSheet or ActiveWorksheet and it doesn't work. can this be done?

Exporting Table To Excel Sheet
When iam using CopyFromRecordset obet in my code to move data from Acces to Excel it said that the object in Acces is out of range. Id there a limit of charracter with this fonction ??

thx for your answer

Exporting Picture To Excel Sheet Using VB.NET
Hello everybody. I'm new here and I have this problem.
I'm trying to create a new excel workbook using a Visual Basic .NET program. I have succesfully placed a button on the form and it creates a new excel workbook but I don't know how to export a picture into the workbook. I have tried almost everything and it doesn't work. I really need your help

Exporting Data To Excel Sheet
Hi,
I have to export the data from my vb application to excel. I know how to export data to an activesheet after opening excel from vb. My question is that if I have to export data to various sheets for eg first to sheet1, then to sheet2 and so on in the same excel file. How to implement that.

Thanks in adv.
Jim

 

Exporting Excel Sheet To Access By VB Code
Hi
I have a problem thats driving me practically insane.
I am trying to export an Excel sheet (existing) to Access table.
I have done it by Macro in an Excel but when i want to do it from VB . meaning i also have to add to it , an action that will open my existing workbook ("test")

i keep getting the same error In the "do While len(range(.... "line.
Error message is that run time error 1004 , Method 'Range' of object "global ' Failed.

i have added dao refs and excel refs to the program.

This code works perfectly as an excel macro!@!!!!

Please help!
Please also assis with how to open an existing excel file from vb .



Private Sub CommandButton1_Click()

' exports data from the active worksheet to a table in an Access database
' this procedure must be edited before use
Dim db As Database, rs As Recordset, r As Long
Set db = OpenDatabase("C:My Documents est.mdb")
' open the database
Set rs = db.OpenRecordset("MFG", dbOpenTable)
' get all records in a table
r = 4 ' the start row in the worksheet
Do While Len(Range("b" & r).Formula) > 0
' repeat until first empty cell in column A
With rs
.AddNew ' create a new record
' add values to each field in the record
.Fields("name") = Range("b" & r).Value
.Fields("total") = Range("c" & r).Value
.Fields("date") = Range("d" & r).Value
.Fields("time") = Range("e" & r).Value
' add more fields if necessary...
.Update ' stores the new record
End With
r = r + 1 ' next row
Loop
MsgBox ("Table transfer completed successfully")
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End Sub

Importing/Exporting A Excel Sheet To/from Listview
Basically i want to import colums from my excel sheet/book to a listview in my form.
Does anyone know how to do this?


Any help is welcome

Thomas

Creating A Query And Exporting To An Excel Sheet
Hi,
This is the piece of code
Private Sub GenerateTransferLatency(ByRef objWB As Excel.Workbook)
Dim objRS As New ADODB.Recordset
Dim objWS As Excel.Worksheet
Dim objWS1 As Excel.Worksheet
Dim lRow As Integer
Dim lSQL As String
Set objWS = objWB.Worksheets.Add
Set objRS = Nothing
lSQL = "SELECT COMPUTER, EQUIPMENTSERNUM, MONITOR_FLAG, UTC_END_TIME, INTERVAL, ACTUAL_UTC_END_TIME, EXPECTED_UTC_END_TIME, DIFF_IN_TIME,DIFF_IN_DAYS FROM (SELECT T1.EQUIPMENTSERNUM, T1.UTC_END_TIME, T1.INTERVAL,T1.COMPUTER, NVL(T2.MONITOR_FLAG,0) MONITOR_FLAG,(T1.UTC_END_TIME + (T1.INTERVAL / 1440)) ACTUAL_UTC_END_TIME, (SYSDATE + (4 /24)) EXPECTED_UTC_END_TIME,ROUND((((SYSDATE + (4 /24)) - (T1.UTC_END_TIME + (T1.INTERVAL / 1440))) * 1440)) DIFF_IN_TIME,ROUND((((SYSDATE + (4 /24)) - (T1.UTC_END_TIME + (T1.INTERVAL / 1440)))),2) DIFF_IN_DAYS FROM TRANSFER_MANAGER T1, EQUIPMENTDEFINITION T2, OSMDEFINITION T3 Where T1.EQUIPMENTSERNUM = T2.EQUIPMENTSERNUM And T2.OSMNAME = T3.OSMNAME AND T1.VALID_UNTIL = '31-DEC-2030' AND HOLD <> 4) Where DIFF_IN_TIME > 120 AND (EQUIPMENTSERNUM IN ( Select Equipmentsernum from Equipmentdefinition where CONTRACT_TYPE not like 'DISC%')) ORDER BY DIFF_IN_TIME DESC"
objWS.Cells.Font.Name = "Trebuchet MS"
objWS.Range("A1:I1").Merge
objWS.Range("A1:I1").HorizontalAl ignment = xlCenter
objWS.Range("A1:I1").VerticalAlignment = xlBottom
'objWS.Cells(1, 1) = IIf(optALL.Value, "Transfer Latency for ALL Units")
objWS.Cells(1, 1).Font.Bold = True
objWS.Cells(2, 1) = "COMPUTER"
objWS.Cells(2, 1).Font.Bold = True
objWS.Cells(2, 2) = "EQUIPMENTSERNUM"
objWS.Cells(2, 2).Font.Bold = True
objWS.Cells(2, 3) = "MONITOR_FLAG"
objWS.Cells(2, 3).Font.Bold = True
objWS.Cells(2, 4) = "UTC_END_TIME"
objWS.Cells(2, 4).Font.Bold = True
objWS.Cells(2, 5) = "INTERVAL"
objWS.Cells(2, 5).Font.Bold = True
objWS.Cells(2, 6) = "ACTUAL_UTC_END_TIME"
objWS.Cells(2, 6).Font.Bold = True
objWS.Cells(2, 7) = "EXPECTED_UTC_END_TIME"
objWS.Cells(2, 7).Font.Bold = True
objWS.Cells(2, 8) = "DIFF_IN_TIME"
objWS.Cells(2, 8).Font.Bold = True
objWS.Cells(2, 9) = "DIFF_IN_DAYS"
objWS.Cells(2, 9).Font.Bold = True
objWS.Range("A2:I2").Interior.Color = vbGreen
lRow = 3
objRS.Open lSQL, objConn, 3, 3, 1
Do While Not (objRS.EOF)
objWS.Cells(lRow, 1) = objRS(0)
objWS.Cells(lRow, 2) = objRS(1)
objWS.Cells(lRow, 3) = objRS(2)
objWS.Cells(lRow, 4) = objRS(3)
objWS.Cells(lRow, 4).NumberFormat = "mm/dd/yyyy hh:mm:ss"
objWS.Cells(lRow, 5) = objRS(4)
objWS.Cells(lRow, 6) = objRS(5)
objWS.Cells(lRow, 6).NumberFormat = "mm/dd/yyyy hh:mm:ss"
objWS.Cells(lRow, 7) = objRS(6)
objWS.Cells(lRow, 7).NumberFormat = "mm/dd/yyyy hh:mm:ss"
objWS.Cells(lRow, 8) = objRS(7)
objWS.Cells(lRow, 9) = objRS(8)
objWS.Cells(lRow, 10).NumberFormat = "0.000"
objRS.MoveNext
lRow = lRow + 1
Loop
objRS.Close
Set objRS = Nothing
objWS.Range("A1:I1", "A" & lRow & ":I" & lRow & "").Columns.AutoFit
Set objWS = Nothing
End Sub
This successfully excutes in an excel sheet where we have 9 columns, after this i need to add an extra column i,e, 10 th coloumn by execting the below query i.e.case statement.
Select Case lSQL
Case "Select * from QUERYSTATUSINFO WHERE BYTESTRANSFERRED

48 AND QUERYDISPATCHTIME>SYSDATE-1"
MsgBox "2048 error", vbInformation

Case "Select * from TRANSFER_MANAGER WHERE HOLD=1"
MsgBox "Unit on hold OSM CONNECTIVITY", vbInformation

Case "Select * from TRANSFER_MANAGER WHERE HOLD=2"
MsgBox "outage", vbInformation

Case "Select * from TRANSFER_MANAGER WHERE HOLD=3"
MsgBox "New Unit", vbInformation

Case "Select * from TRANSFER_MANAGER WHERE HOLD=4"
MsgBox "DISCONNECTED", vbInformation
Case Else
MsgBox "Did not recognized this statement"
End Select
Can some body help me out , how to create the last column and fill it throgh this Select queries.
Thanks
Sneha

Exporting Access Database Into A Excel Sheet
Dear Friends!

 Please help me to export a Access databse into a excel sheet efficiently.
 I need to export several Access tables into the worksheets within the same workbook.
 
thanks

Regards
Brinda

Exporting Data To Excel From A Web Page Table
Hi guys
I'm trying to create an ActiveX control that will export the contents of a table on a web page to an excel spreadsheet. I would be really grateful is anyone could tell me hoe to do this or even how to export a comma deliminated file to excel.

Thanks a lot
JK

Remove Garbage Data From Excel Sheet
I am trying to retrive data from from an excel sheet and insert
in access database. sometimes excel sheets return garbage data as well like the last rows are not used but they are returned. i can check if they are null and remove them but i would like to know if there is a vb routine with which instead of checking null i can remove the rows which are garbage.

Remove Hyperlinks From Organization Chart In Excel Sheet
Following code is removing all the hyperlinks from excel sheet except from organizational chart..
I am creating a activex control in vb.

Code:
Dim objexcel As Excel.Application
Dim objworksheet As Excel.Worksheet
Dim objworkbook As Excel.Workbooks
Dim hlink As Excel.Hyperlinks

Private Sub cmddelete_Click()
Set objexcel = CreateObject("Excel.Application")
objexcel.Workbooks.Open ("c: est hyper.xls")
objexcel.WindowState = xlMinimized
objexcel.WindowState = xlMaximized


Dim Shp As Excel.ShapeRange
Dim IShp As Excel.Shape
Dim i As Integer
Dim j As Integer
On Error GoTo ResNextShp


For j = 1 To objexcel.ActiveSheet.Shapes.Count

objexcel.ActiveSheet.Shapes(j).Select
Set Shp = Selection.ShapeRange
If Shp.HasDiagramNode = msoTrue Then
For i = 1 To Shp.DiagramNode.Diagram.Nodes.Count
Set IShp = Shp.DiagramNode.Diagram.Nodes(i).Shape
If IShp.Hyperlink.Address <> "" Then
IShp.Hyperlink.Delete
End If
Next i
End If
Set IShp = objexcel.ActiveSheet.Shapes(j)
If IShp.Hyperlink.Address <> "" Then
IShp.Hyperlink.Delete
End If
Next j
i = 0

For i = objexcel.ActiveSheet.Hyperlinks.Count To 1 Step -1
objexcel.ActiveSheet.Hyperlinks(i).Delete
Next i

Exit Sub

ResNextShp:
Resume Next

End Sub

Parse A Web Page Into An Excel Sheet
First, we'd like to say hello.

Ok. My lab partner and I are having difficulty with a VB program. We are supposed to parse a webpage from HTML code into an excel spreadsheet, using a file inputed from a user. We have our program outlined below

Public Sub vbaprogram()
Dim userinput As String
Dim file As String
Function Parse() As String
Function Build() As String


userinput = InputBox("Do you want to parse or build? Please put P or B.")

If userinput = P Then
'start parsing
Call Parse


If userinput = B Then
'start building
Call Build


Else: InputBox ("Please enter either P or B.")
End If

End Function

Function Parse()
file = InputBox("Please enter file name.")
Open "file" For Input As 1

End Function

Function Build()
file = InputBox("Please enter file name.")
Open "file" For Input As 2
End Function

***
Ok, now, we arent quite sure how to approach this task. Can anyone help us determine how the function should be laid out? Thank you so much if anyone replies.

Chris and Sena

Populating Excel Sheet From A Web Page
Hi all,
  
  following are my querries :
 
 1) how do i invoke MSExcel from my web page?
 ( i want to invoke excel to make it draw a graph for me)

2) also to make excel draw a graph(chart) i will have to populate the excel sheet with values returned by my sql.
how do i fill/populate an excel sheet?

3) assumung the above two work fine i.e excel draws a graph for me....is there anyway for me to save it as a .jpg or a .gif thru my web page only....so that when i make the brower call my page he gets a .jpg or .gif graph/chart?

  PS: i dont want code for the above querries but only hints/pointers that will help me understand how to go about it and write the code myself.

regds
SN

Embedding An Excel Sheet Or A Web Page
Hello

i want to embed an Excel sheet and a XML or HTM page in a VB Form
without using the OLE Container(for the Excel Sheet )

Thanks

Retrieving An Excel Sheet Checkbox Data In ASP Page?
Hi All,
I have and excel sheet with a Checkbox field.I need to read the checkbox data(if checked then true else false) from an ASP page and need to update a database.Can anyone pls help me??
Thanks in advance
Rajeev

How To Export An ASP Page Data Values Into Excel Sheet
Hi all,
How can i export an ASP page data i.e.,text box values into Excel sheet and vice versa also?

Thanks in Advance.

regards
fakru

Exporting An Access Table To A New Excel SS And Open Excel File Afetr Export
Hi,

Can some help me with writing the code to Export a table from Acces into a new excel spreadsheet, then open an instance of excel to view the newly exported table? I can get the file to export but I am having trouble with the code to open Excel, thanks for you help. See code below..

Private Sub Command26_Click()

DoCmd.TransferSpreadsheet transfertype:=acExport, _
        tablename:="newreqtable", _
        FileName:="F:UserdataSelectionData.xls", hasfieldnames:=True, _
        Spreadsheettype:=8
        
MsgBox "Export is Complete", vbOKOnly, "Selection Data Export"

MsgBox "Your new file is located on F:UserdataSelectionData.xls", vbOKOnly, "Data Export Location"

'This is where I need to have excel open the file for the client.

End Sub

Exporting Excel File
Is there any code on how to export a filtered recordset to an excel file?

Exporting A Excel File To A New One
i'm having problems with my Save As code. the point is not let the users change the original file, so they save a copy of it. i'm trying to save the file into a new one. here is the code i have so far:

Sub SaveFile()
'GET FILE SAVE LOCATION FROM THE USER
Dim strFiles As String
Dim message As Integer
With cdlCommDlg
.InitDir = App.Path
.Filter = "Excel Workbook (*.xls)|*.xls|" & "INI FIles (*.ini)|*.ini|" & "All Files (*.*)|*.*"
.Flags = cdlOFNAllowMultiselect + cdlOFNLongNames + cdlOFNExplorer
.Max = 3000
.ShowSave
End With
'FULL FILE LOCATION STORED IN strFiles
strFiles = cdlCommDlg.FileName
If strFiles = "" Then
Exit Sub
End If
'EXPORT THE FILE
Dim newFile As New Excel.Application
Dim newWorkbook As New Excel.Workbook
Dim newWorksheet As New Excel.Worksheet
'Create a new Workbook and add a new worksheet
Set newWorkbook = newFile.Workbooks.Add
Set newWorksheet = newWorkbook.Worksheets(1)

'Add data to the sheet
'Set objExcelWorkbook = .Workbooks.Open(sFileName, 0)
objExcelChart.Sheets.Copy after:=newWorkbook.Sheets(1)
newWorksheet.Copy
'newWorksheet.Activate
'Save the workbook, quit Excel. newWorkbook.SaveAs (strFiles)
newFile.Workbooks(1).Close SaveChanges:=True

newFile.Quit
MsgBox strFiles & " was saved successfully. ", vbOKOnly, App.ProductName
'Close all objects
Set newFile = Nothing
Set newWorkbook = Nothing
Set newWorksheet = Nothing
checkChanges = False
End Sub

Exporting An Excel File To Access
Hi

Im doing a project where i need to calculate results using an excel macro and then save to an excel sheet.This sheet must then be exported and apended to the end of an access file.

Any idea's would be greatly welcomed

thank

Exporting Excel File Items To A Text File
Hello Friends,

I have a Excel file and i need to write a macro to export 1st column fields to a text file in which all the field elements are seperated by coma..could u pl suggest me how to do that, sample code will be helpful

Thanks

Exporting Excel Data To Text File
I have the code to Export an Excel worksheet to a text file, but due to the variable length of the data in the columns, the data in the text file isn't aligned in the proper positions.

Is there a way to set tabs or something like that in the output file, so the data will be placed in fixed positions ?

Thanks for any help...

VS 2003 Large File When Exporting To Excel
I have recently started using VS along with
sql repoorting services creating reports with the report wizard.
When the report is exported to Excel the reports are about 10
times the size of the exact same report exported using Cognos
Impromptu any ideas what is causing the file to be so large. If
this is not the correct forum for question let me know.

Thanks

Need Help With Exporting And Saving MSHFlexGrid To Excel File
hi there folks its been going so slow since morning i have tried all the ways the following is the code for to export to the excel file - but it doesn't seem to work - as soon as the SEND TO FILE (cmdFile) button is clicked - nothing happens no action, also
the other button send to printer when clicked invokes the dialog for the printer but clicked ok does not prints until the application quits,


Code for cmdFile


Private Sub cmdFile_Click()

'CommonDialog2.ShowSave
'frmExcel.oleExcel = frmGrid.MSHFlexGrid1.OLEDrag
Dim loop1 As Long
Dim loop2 As Long

'declare and instantiate the excel variable
Dim MyExcel As Object
Set MyExcel = CreateObject("Excel.Application")

Dim MyWorkBook As Excel.Workbook
Dim MySheet As Excel.Worksheet

With MyExcel
    .DisplayAlerts = False
    .Interactive = True
    .IgnoreRemoteRequests = False
    .EnableSound = True
    .EnableEvents = True
End With

'Create new excel workbook
Set MyWorkBook = MyExcel.Workbooks.Add

'Add a sheet to the workbook
Set MySheet = MyWorkBook.Sheets.Add

'Loop through all the cells in the grid
For loop1 = 0 To frmGrid.MSHFlexGrid1.Rows - 1
For loop2 = 0 To frmGrid.MSHFlexGrid1.Cols - 1

'Set the current row and coloumn
'frmGrid.MSHFlexGrid1.Row = loop1
'frmGrid.MSHFlexGrid1.Col = loop2
'the text property of the grid contains the textat the current row & Col
'set the value of the corressponding worksheet cell
MySheet.Cells(loop1 + 1, loop2 + 1) = frmGrid.MSHFlexGrid1.TextMatrix(loop1, loop2)

Next loop2
Next loop1

'Save the workbook
MyWorkBook.SaveAs (frmChoose.cmbChoose.Text & frmSelect.cmbReport.Text & frmSelect.cmbType.Text & ".xls")

'Close the workbook
MyWorkBook.Close

Set MySheet = Nothing
Set MyWorkBook = Nothing

'Quit Excel
MyExcel.Quit

Set MyExcel = Nothing

End Sub

Exporting Data From ADO Recordset To Excel File.
I want to export data from an ADO recordset directly onto an Excel file. My recordset contains about 1 lakh records so I do not want to run this in a loop as it takes a very very long time.
Please suggest a fast way of achieving this.
Thanks.

Importing Data From One Closed Excel Sheet Into Another Open Excel Sheet
Dear all,
   I am VBA newbie ... I need your help in importing the data froma closed excel document into another excel document.

Please help.
Cheers
Vivek

Exporting Excel File Then Append To MS Access Table
Hi,

Does anybody with this one. I have 3 different tables in MS access (table1, table2,table3) that contain different data. Data are coming from Ms Excel (xl1.xls, xl2.xls, xl3.xls).

How can I possibly do openfile and then can select one time all the 3 excel file I have and then can append it automatically to access table :table1 for xl1.lxs , table2 for xl2.xls and table3 for xl3.xls.

I want to do the code in VBA access. thanks!

Exporting To Excel Wont Work When The Program Is Compiled Into A .exe File
Sir/s,

Hope you can help me with this bug.... im having difficulties on this.....

Thanks !

Exporting Search Results To Excel Spreadsheet And Email The File
I have a windows form, which has some search functions.
How do I export the search results to an Excel spreadsheet and automatically send it to the user's email account?

Thanks,

Dave

Active Sheet In An Excel File
here is the situation,
i query data from the database then wirte it on an Excel File,
the user is given the choice to name the sheet....

for example the user made a query typed in "Test 1" as the
sheet name... Test 1 does not exist.. so my program creates
a sheet name "Test 1".

after that the user makes another query and names the sheet
as "Test 2". Test 2 doens not exist so my program creates a sheet
named "Test 2".

then the user makes another query and names the sheet as "Test 2",
Test 2 already exist so my program will clear the existing data
and write the NEW Data in "Test 2" sheet.

however, if the user makes another query and names the sheet "Test 1"
my program still access "Test 2" because it is the active sheet, or the
sheet on the left most of the excel, the data on "Test 2" sheet is
cleared...

however since the sheet name does not correspond to the sheet name
provided by the user, no data is written on "Test 2"....

how can i somehow, loop through the excel file to search the entire sheet
names and not just compare the sheet name provided by the user and
compare it with the active sheet...

thanks

Export Excel Sheet To .csv File Using VB6
I can't seem to find what I'm looking for. I'm attempting to read an xcel file and output a sheet to a .csv file. The code I'm using is SLOWER than molasses in january. It takes a second for each row to be processed. There has got to be a faster way. Not fancy, but I'm attempting to create the .csv file before finishing it up.

Here's my code:

Public Function ProcessXLS(ByVal srcFile As String, ByVal destFile As String, _
Optional AppendData As Boolean, Optional StrDelimiter As String)
Dim wkbObj As Object, ActSht As Integer, FNum As Integer
Dim BeginRow As Integer, BeginCol As Integer, strCellData As String
Dim EndRow As Integer, EndCol As Integer, i As Integer, StrDelim As String
Dim RowIdx As Integer, strDataLine As String, ColIdx As Integer
If StrDelimiter = "" Then StrDelimiter = "," 'default
LogMsg "Entering XLS for " & srcFile, True
On Error GoTo ERR_XLS
Set wkbObj = CreateObject("Excel.Application")

'open the excel spreadsheet
wkbObj.workbooks.Open srcFile, True
'==========================================
'get the name of all sheets in the workbook
Dim wsNames(100)
Dim wsNamesCnt As Integer
wsNamesCnt = 0
'just seeing what's available.
For Each sh In wkbObj.activeWorkbook.Sheets
wsNames(wsNamesCnt) = sh.Name
wsNamesCnt = wsNamesCnt + 1
Next sh
'active sheet???
ActSht = 0
'open output file
destFile = destFile & Trim(wsNames(ActSht)) & ".CSV"
FNum = FreeFile
If AppendData Then
Open destFile For Append Access Write As #FNum
Else
Open destFile For Output Access Write As #FNum
End If

With wkbObj.ActiveSheet.UsedRange
BeginRow = wkbObj.ActiveSheet.UsedRange.cells(1).Row
BeginCol = wkbObj.ActiveSheet.UsedRange.cells(1).Column
EndRow = wkbObj.ActiveSheet.UsedRange.cells(wkbObj.ActiveSheet.UsedRange.cells. Count).Row
EndCol = wkbObj.ActiveSheet.UsedRange.cells(wkbObj.ActiveSheet.UsedRange.cells. Count).Column
End With

For RowIdx = BeginRow To EndRow
StrDelim = ""
strDataLine = ""
Debug.Print Time
For ColIdx = BeginCol To EndCol
strDataLine = strDataLine & StrDelim & Chr$(34) & strCellData & Chr$(34)
' strDataLine = strDataLine & StrDelim & strCellData
StrDelim = StrDelimiter
Next ColIdx
Debug.Print Time
Print #FNum, strDataLine
Debug.Print Time
DoEvents
Next RowIdx
'==========================================
wkbObj.workbooks.Close
wkbObj.Quit
Set wkbObj = Nothing

END_XLS:
ProcessXLS = strRetCode
LogMsg "Exiting XLS", True
Exit Function

ERR_XLS:
strRetCode = Error(Err.Number) & " " & Err.Description
If IsObject(wkbObj) Then
If wkbObj.Name = "Microsoft Excel" Then
LogMsg ("Error XLS: " & strRetCode)
wkbObj.workbooks.Close
wkbObj.Quit
End If
End If
Resume END_XLS

End Function

Any help is appreciated.

Thanks
Matt.

How To Import File From Excel Sheet
Hi All,

Is it possible to import .xls file from VB?

If yes, Can Anyone tell me HOW?

How Do I Force A New Sheet In Excel From VB File ?
Afternoon people.

I am creating a .CSV file from a VB program, and I am importing it into Excel.

Is there a character I can insert at a particular point, so that when the .CSV file is read into Excel, it will force a new shet to be added ?

I don't think there is but thought I would ask on the slim chance .....

How To Declare An Excel File And A Certain Sheet In Vb
Hi,

I am writing a program to delete some part from an excel sheet.
Say, I have a file, C:abcdelete.xls and a sheet, InvalidRate.

I need to delete rows starting from second rows and columns to F.

Can anybody give some ideas?

Thanks.

What Would Be The Code In Visual Basic For Exporting Ms Access Table Data To Ms Excel File
what would be the code in Visual Basic for exporting ms access table data to ms excel file ...?

Creating Master Excel File From Many One Page Excel Files
I am using VB6 and am able to create a master excel file of Teaching schedules by getting all files in a specific directory that start with S2004. Starting with line 26 (MaxTimes = 11 represents time slots from 8a to 10p at night, increments of 1 hr 15 min classes) is a synopsis of the classes that an instructor will be teaching. So far I can create a single sheet in the master file from all the other schedules. What I would like to do is add a copy of the individual schedules into the master file. So, Master Sheet 1 (named 'MASTER') will still contain the synopsis. Master Sheet 2 will be a copy of Person#1's schedule (named for that person), Master Sheet 3 will be a copy of Person#2's schedule (named for that person), etc. My attempt below is not working. Please help. Thanks.

Private Sub CreateMasterSchedule_Click()
Dim Filename As String, Path As String
Dim Workbook, WorkbookAll As Workbook
Dim Worksheet, WorksheetAll As Worksheet
Dim Row As Integer, RowAll As Integer, i As Integer, j As Integer
Dim SheetNumber As Integer

'create MASTER file composed of individual schedule data
Set ExcelAll = New Excel.Application
Set WorkbookAll = ExcelAll.Workbooks.Add
Set WorksheetAll = WorkbookAll.ActiveSheet
WorksheetAll.Name = "MASTER"
RowAll = 1
SheetNumber = 2

Dialog1.Show
Dialog1.Label1 = "Loading..."

' Workbook.Worksheets.Add
' Set Worksheet = Workbook.ActiveSheet

Path = "c:"
Filename = Dir(Path)
Do While Filename <> ""
If Mid(Filename, 1, 6) = "S2004_" Then
'get data from files
Set Excel = New Excel.Application
Set Workbook = Excel.Workbooks.Open(Path + Filename)
Set Worksheet = Workbook.ActiveSheet
' WorkbookAll.Sheets(SheetNumber).Select
Dialog1.Label1 = Dialog1.Label1 + Chr(10) + "Processing " + Path + Filename + "..."
Row = 1
'offset of 3 accounts for two rows at top (Name, Days) and space row between last time slot and row data
Do While Worksheet.Rows.Cells(2 * MaxTimes + 3 + Row, 1) <> ""
For i = 1 To 12
'preserve date format as 03/14/98 instead of 34768
If i = 9 Or i = 10 Then
WorksheetAll.Rows.Cells(RowAll, i) = CStr(Worksheet.Rows.Cells(2 * MaxTimes + 3 + Row, i))
Else
WorksheetAll.Rows.Cells(RowAll, i) = Worksheet.Rows.Cells(2 * MaxTimes + 3 + Row, i)
End If
Next i
Row = Row + 1
RowAll = RowAll + 1
Loop
'copy schedule onto another sheet in the MASTER file
' WorkbookAll.Worksheets.Add
'I haven't figured out how to select and copy the entire sheet yet
' For i = 1 To Row
' For j = 1 To 12
' WorksheetAll.Rows.Cells(i, j) = Worksheet.Rows.Cells(i, j)
' Next j
' Next i
' WorksheetAll.Name = Mid(Filename, 6)
'change back to MASTER list sheet to add next faculty's info
' SheetNumber = SheetNumber + 1
' WorkbookAll.Sheets(1).Select
'close faculty file
Call Workbook.Close(False)
Excel.Quit
Set Excel = Nothing
End If
Filename = Dir() ' Get next entry.
Loop
WorksheetAll.Cells.Sort Key1:=Range("A1:L" + CStr(RowAll))
' WorksheetAll.Cells

WorkbookAll.SaveAs ("c:Documents and SettingscegDesktopMASTER")
Call WorkbookAll.Close(False)
ExcelAll.Quit
Set ExcelAll = Nothing

Dialog1.Hide
End Sub

Trying To Import Multiple .csv File Into 1 Excel Sheet
Hi guys,

This is my first visit to these forum. I'm quite new to visual basic programing and I'm trying to create a macro within Excel to import multiple .csv files at the same time.

Here are more details:

All files are in the same directory and I want that macro to look at the entire directory and get all .csv files and put it one after the other into an Excel sheet.

All files have the same size (250 lines) but I want to leave a blank space between each of the imported files.

I'm sure this must be a very simple thing to do for experts but for me, it's a nightmare. I'm really working hard, but after 3 weeks of trial an error, I give up.

Please post anything to help me. Code sample would be better.

Thanks in advance for the help.

JF.

How To Focus In Sheet When Open Excel File
Can some help in this question:

how i make the excel file to always focus in my cover sheet when someone open it ?





Best Regards.

How To Save An Access File As Excel Sheet?
Hi,

Could somebody let me know about how to save an access table as Excel sheet?

Thanks in advance.

Margaret

Edit A Text File In A Sheet On Excel
mlahlou@bouyguestelecom.fr

Hiii every body.
I'm looking for a solution to my problem that is:
" I need to edit a text file in a sheet on excel associated to a VB form."
Tx

Open Excel File With Specific Sheet
Hello to all developer

I want to open a excel file with specific sheet. For ex.

I have a excel file with name : products and it has a 3 sheets namely
monitor , UPS , Processor.

and I want is to open the excel file and automatically show the UPS sheet..

anyone knows this please help.



Thanks
Joseph

Saving Excel Sheet As Image File
I need to save a portion of an excel sheet as an image file

meaning,
I have an excel sheet with some values in it. ranging from A:0 to C:4 I need to save this portion as an image file.

This has to be done programatically. And the range varies along with the sheet.

viren

Need To Insert A Row In An Excel File Spread Sheet.
I need to insert a row in a excel file spreat sheet. Please tell me how to do that.

Sam

Read Csv File && Create Excel Sheet
I need help on doing this : I want to read a predefined Csv file and then create an excel worksheet based on the csv file values.
The values from csv are seperated with commas... how can I do this ? Please help , I 'm novice

How To Remove Columns From An Excel File
Dear People,

How can I write a little app or macro to remove certain columns from an excel file? I know there is some kind of API for excel. Where I can find info about it?

I need to run this little app or macro in excel when the desired file is open.

I'll appreciate your help.

Luis F Hernandez
Carlsbad, CA

Data Transfer From Text File To Excel Sheet Using DAO
How to transfer data from Text file where data column is seperated by commas(cvst file) to Excel sheet using DAO or ADO via VB interface ???

Concating Data Of More Than One Excel Sheet To One Sheet In The Same Work Book
Dear

I want to concate data of sheets in to another sheet in the same work book through VB.Please help me

Copyright © 2005-08 www.BigResource.com, All rights reserved