Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Appeding user data to the end of excel file

Hi friends,

I wrote a macro such that it will append some data at the end of th
excel file(I opened the file in binary mode and wrote the content)

The sample code will be like this

Open filename For Binary Access Write As #1
If startpos = 0 Then
startpos = LOF(1)
End If

Put #1, startpos, "my data"
Close #1

After closing the file and opening it in Notepad the data is stil
there.

But if i reopened it in excel and closed the file, the data is gone.
Excel overwrites the user defined data.

Assist me in keeping my data persistent so that i will retrieve th
contents and process it

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Appeding user data to the end of excel file

You can't just write to Excel files using VBA's file write
procedures. Excel files are internally extremely complicated, and
VBA doesn't support the data types required to manipulate them
directly. You should use Excel itself to modify Excel files.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Bharathi mohan "
wrote in message
...
Hi friends,

I wrote a macro such that it will append some data at the end

of the
excel file(I opened the file in binary mode and wrote the

content)

The sample code will be like this

Open filename For Binary Access Write As #1
If startpos = 0 Then
startpos = LOF(1)
End If

Put #1, startpos, "my data"
Close #1

After closing the file and opening it in Notepad the data is

still
there.

But if i reopened it in excel and closed the file, the data is

gone.
Excel overwrites the user defined data.

Assist me in keeping my data persistent so that i will retrieve

the
contents and process it.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Appeding user data to the end of excel file

Some references:

http://support.microsoft.com/?id=253338
INFO: Office Developer Samples and Tools Available for Download

http://support.microsoft.com/?id=260410
OFF2000: Microsoft Office 2000 Automation Help File Available



--
Regards,
Tom Ogilvy

"Chip Pearson" wrote in message
...
You can't just write to Excel files using VBA's file write
procedures. Excel files are internally extremely complicated, and
VBA doesn't support the data types required to manipulate them
directly. You should use Excel itself to modify Excel files.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Bharathi mohan "
wrote in message
...
Hi friends,

I wrote a macro such that it will append some data at the end

of the
excel file(I opened the file in binary mode and wrote the

content)

The sample code will be like this

Open filename For Binary Access Write As #1
If startpos = 0 Then
startpos = LOF(1)
End If

Put #1, startpos, "my data"
Close #1

After closing the file and opening it in Notepad the data is

still
there.

But if i reopened it in excel and closed the file, the data is

gone.
Excel overwrites the user defined data.

Assist me in keeping my data persistent so that i will retrieve

the
contents and process it.


---
Message posted from http://www.ExcelForum.com/





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default Appeding user data to the end of excel file

"Chip Pearson" wrote ...

You can't just write to Excel files using VBA's file write
procedures. Excel files are internally extremely complicated, and
VBA doesn't support the data types required to manipulate them
directly. You should use Excel itself to modify Excel files.


Another option is to use the Microsoft OLDB Provider for Jet i.e. ADO
and SQL to write data to an Excel file. Using SQL's INSERT INTO syntax
will append the new row to the bottom of the Excel range.

Jamie.

--
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharing Excel file for multiple user Farhad Excel Discussion (Misc queries) 2 February 3rd 09 05:49 PM
Multiple user excel file Nithin New Users to Excel 1 August 14th 08 05:59 AM
macro to save as a data input by user file name from a designated Brian Excel Discussion (Misc queries) 2 November 20th 07 04:00 AM
Need to Query Excel File Opened by Another User Paul Excel Discussion (Misc queries) 0 December 13th 06 05:57 PM
Excel allows access to more than one user to same file Bernie G Excel Discussion (Misc queries) 2 March 8th 06 09:03 AM


All times are GMT +1. The time now is 08:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"