473,796 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Append textfile to textfile /Excel 2003 macro

125 New Member
With my Excel macro and two text files I want to create a new textfile containing the first textfile then text from the sheet and then the second textfile.

My problem is that i don't know how to append the second textfile.

Expand|Select|Wrap|Line Numbers
  1. Sub mysub()
  2.     Dim TempString As String
  3.  
  4.     'Open the first file 
  5.     Dim fileA As Integer
  6.     fileA = FreeFile()
  7.     Open "C:\A\B\C1.txt" For Append As fileA
  8.  
  9.     'Here i will later append stuff from the Excell sheet
  10.     TempString = "Hello1"
  11.     Print #fileA, TempString
  12.     Print #fileA, TempString
  13.  
  14.     'Open the last part of the textfile
  15.     Dim EndPart As Integer
  16.     EndPart = FreeFile()
  17.     Open "C:\A\B\D2.txt" For Input As EndPart
  18.  
  19.     'Here I want to append #EndPart to #fileA 
  20.  
  21.     Close EndPart
  22.     Close SVGfile
  23. End Sub
  24.  
Followed this:
http://www.xtremevbtalk.com/showthread.php?t=123814
Oct 14 '08 #1
1 2821
asedt
125 New Member
http://www.microsoft.com/technet/scr...4/hey1201.mspx


Used that and got it working wery good for me.
Oct 15 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
17419
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed a database for her which is intended to make things a lot easier; however, I don't have a lot of experience with Access and I find that designing the reports in Access is tedious. I want to be able to print the reports (which are simply based on...
17
6348
by: Mansi | last post by:
I need to do some research on how to use excel automation from c#. Does anyone know of any good books related to this subject? Thanks. Mansi
2
10354
by: Jacob.Bruxer | last post by:
Hi everyone, I'm having trouble opening space delimited textfiles in Excel from Visual Basic.net. I'm able to control, open and modify Excel files from Visual Basic, so my Excel reference seems to be working ok. I just don't know what I'm doing when I try to open a space delimited file and want to put the data into columns. I tried recording a macro in VBA and going from there, but then I got stuff saying "Name 'xlDelimited' is not...
2
17725
by: Senthil | last post by:
Hi All I need to create an Excel report and create a command button and have to run a macro on the click event that will print all the pages in the Excel workbook. I am able to create the report from the database but I am not sure how do I put a command button and associate a macro with that using C#. Can anyone help me?? Thanks in advance. Senthil
6
6316
by: jcf378 | last post by:
hello-- i am having trouble figuring out how to export individual records from an Access 2002 Form into a pre-existing Excel spreadsheet, such that the exported record is merely appended to the Excel file, rather than completely overwriting it (as occurs with the basic OutputTo function). specifically, I am trying to create a macro that "backs-up" any deleted record. So, when someone goes to delete a record (i have a delete-record macro...
3
8088
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we incur numerous service problems “Events”. Each morning we have a global conference call where events which occurred within the previous 24 hours are discussed. Prior to the call, an analyst has to review these events and provide a report, ‘The Morning...
7
14406
by: Holger Fitschen | last post by:
Hi to all, I want to use the Excel solver in a VB.Net project. The macro Sub Makro1Solver() Application.Run "Solver.xla!Auto_Open" SolverReset Worksheets(1).Select Worksheets(1).Range("B9").Select
0
2671
by: sandervanee | last post by:
Hello, I am trying to export several Access 2003 select queries to Excel 2003 using an Access macro. I'm using the macro command "TransferSpreadsheet" to export the queries. This going quit well, but I've one problem. The first problem is that in Excel apostrophes ('), carets (^), quotation marks ("), or backslashes (\) appear in the formula bar but not in the cells, like it does when you import in Excel from Lotus. When I use the command...
8
2462
by: Briansmi1116 | last post by:
Hi all, I am using Access 2003 as well as Excel 2003. I have an Access database that has an output to Excel button I created. This outputs a form to an Excel file A. I then have Excel file B formatted and linked to A. I would like to do this without the link, where when I export to Excel, it automatically formats the Fields. If I run the macro in Excel to format on open, every time I export the file it deletes the macro. So this...
0
9527
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.