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: 33
Default savecopyas issues

I am attempting to use savecopyas method in order to take a processed csv
file, to which I add additional sheets, including some output data and a
chart.

The problem occurs in that I've coded a form with the option of creating
a chart of the output. When I select the option to create a chart, the
processed csv file saves perfectly as an excel file (with the original
input data, output data, and a chart). However, when the option to chart
the data is not selected, the processed csv file only saves one of the
worksheets...and it's garbeled at that. Instead of the output being
displayed in four separate colums, all the data gets jammed into one
colum and separted by commas.

What's so bizarre is that the output routine occurs before that chart
routine and therefore independent of it.

Here is the code for the main body of the program. If someone would
desire to look at more, I'd be happy to forward an example of the input
data, an output file, even the rest of the code. And I'd be obliged to
receive any critique offered.

Thanks everyone for the great help you've been to my recent posts.

Smokii

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
Option Explicit
Option Base 1

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'These variables declared here because they cannot be passed as arguments
between form
'and modules
Public ppi As Double
Public DispTol As Double
Public MaxErr As Double

Public NoXSec As Integer

Public cancelflag As Boolean
Public OpenFileflag As Integer

Public filelist() As String



Sub Main()

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
Dim ncracks As Integer

Dim i As Long

Dim Time1 As Double
Dim Runtime As Double

Dim vsplit As Variant

Dim cracks() As Double
ReDim cracks(1 To 3, 1 To 1000) As Double
'cracks(1,j) x
'cracks(2,j) y
'cracks(3,j) w

Dim xlsfilelist() As String

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'show Inputsettings user form
fmInputSettings.Show

'End routine if user clicks cancel
If cancelflag Then
End
End If

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'Store InputSettings variables
ppi = fmInputSettings.tbppi.Value
DispTol = fmInputSettings.tbDispTol.Value
MaxErr = fmInputSettings.tbMaxErr.Value
NoXSec = fmInputSettings.tbNoXSec.Value


'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'Open File Options
Call Files(filelist, xlsfilelist)


'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'Start Timer
Time1 = Timer

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'Turns off screen updating for faster processing
Application.ScreenUpdating = False

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'Begin Processing

For i = 1 To UBound(filelist)
Workbooks.Open filename:=filelist(i)

ActiveSheet.Select


'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
Call DEL_Error(MaxErr)
Call NewOD
Call cracksolve(NoXSec, DispTol, cracks, ncracks)
Call Out(cracks, ncracks)
If fmInputSettings.cbGraph Then Call Graph(ncracks)

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
With ActiveWorkbook
.SaveCopyAs filename:=xlsfilelist(i)
.Close savechanges:=False
End With


'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'Clear Cracks Array
ReDim cracks(1 To 3, 1 To 1000) As Double

Next i


'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'End Timer
Runtime = Timer - Time1
MsgBox Runtime

'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%
'Turns on screen updating
Application.ScreenUpdating = True

End Sub
 
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
savecopyas question scott23[_3_] Excel Programming 1 October 4th 04 02:12 PM
saveCopyAs judith Excel Programming 1 September 29th 04 11:21 AM
SaveCopyAs Greg Hadrych Excel Programming 4 July 28th 04 07:49 PM
SaveCopyAs Mark Worthington Excel Programming 4 February 8th 04 06:00 AM
SaveCopyAs macro Baddad007 Excel Programming 1 December 31st 03 12:26 AM


All times are GMT +1. The time now is 01:46 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"