LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Problem: SaveAs / SaveAsCopy methods

Hi Terence,

Here's one way to solve the problem:

Worksheets("Sheet1").Copy
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\TEST.DBF", _
FileFormat:=xlDBF3, CreateBackup:=False

This copies Sheet1 into a new workbook and then saves the new workbook to a
..dbf format.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Terence" wrote in message
...
Hi,

There are 3 worksheets (Sheet1,Sheet2,Sheet3) in my excel
file and this file contains an Excel macro program. I am
trying to write some codes to save the contents of Sheet1
to a DBF format file. (This DBF file will be imported to
another system for other purposes).

Here comes the problem, if I use the code:
'*******
Sheets("Sheet1").Select
Range("A1").Select
ActiveWorkbook.SaveCopyAs (ThisWorkbook.Path & "\TEST.DBF")
'*******
Then the file "TEST.DBF" contains all 3 sheets. But I need
the data on Sheet1 only. This method also save all the
macro code to the file "TEST.DBF".

If I use the code:
'********
Sheets("Sheet1").Select
Range("A1").Select
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "\TEST.DBF", _
FileFormat:=xlDBF3, CreateBackup:=False
'********
This method just save the data of Sheet1 to TEST.DBF but
it also changes the name my original Excel to "TEST.DBF".
I am afraid that the users will save the file carelessly
when they close the file.

Therefore, is there anyone knows any better way to do the
task? Thanks in advance!

Terence



 
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
Problem using SaveAs method Sujata Excel Discussion (Misc queries) 4 March 30th 10 07:21 AM
SaveAs problem Jessi Excel Programming 2 July 31st 03 07:36 PM
SaveAs problem, renames Worksheet too E.Anderegg Excel Programming 2 July 29th 03 02:54 AM
Search Methods Dave Peterson[_3_] Excel Programming 0 July 11th 03 03:30 AM


All times are GMT +1. The time now is 12:34 PM.

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

About Us

"It's about Microsoft Excel"