RE: Need help to create a macro or vba script to export data from exce
- From: v-phuang@xxxxxxxxxxxxxxxxxxxx ("Peter Huang" [MSFT])
- Date: Thu, 11 Jan 2007 08:48:40 GMT
Hi,
I think you may try to use the code below to dump the cell one by one, so
that we can accurately control the output.
Here is a sample for your reference.
Sub Test()
Dim fso As New FileSystemObject
Dim ts As TextStream
Set ts = fso.CreateTextFile("c:\temp\output.txt", True, True)
Dim col As Integer
col = 4
Dim row As Integer
row = 8
Dim i As Integer
Dim j As Integer
For i = 1 To row
For j = 1 To col
If j = col Then
ts.Write CStr(Cells(i, j))
Else
ts.Write CStr(Cells(i, j)) & ","
End If
Next
ts.Write (vbCrLf)
Next
ts.Close
End Sub
Also for your second question about sending mail from the macro, we can
automation Outlook to do that.
Here is KB for your reference.
161088 Using Automation to Send a Microsoft Outlook Message
http://support.microsoft.com/default.aspx?scid=kb;EN-US;161088
If you still have any concern, please post back and I am glad to be of
assistance.
Best regards,
Peter Huang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
.
- Follow-Ups:
- RE: Need help to create a macro or vba script to export data from
- From: Yann de Champlain
- RE: Need help to create a macro or vba script to export data from
- Prev by Date: Re: How to update bulk data from Excel to Access database using VSTO
- Next by Date: RE: Need help to create a macro or vba script to export data from
- Previous by thread: Re: How to update bulk data from Excel to Access database using VSTO
- Next by thread: RE: Need help to create a macro or vba script to export data from
- Index(es):
Relevant Pages
|
Loading