Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving and copying results

I have built an excel file that has a number of worksheets in it, 1 ha
stats, 1 charts and the other 3 or 4 have lists generated by macros
The original data is in a sheet but linked to an access database. Wha
I want to be able to do is to have excel prompt the user as to whethe
they would like to get reports (yes/no) and if so copy the stats page
charts and the lists to another excel file and give that new file th
name "date time" Report. It would be helpfuf if a dialog box appeare
to tell the user where the file had been saved.
This might be a bit long winded but Im not sure of where to start
Please help

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving and copying results

Alistair,

Depends what event triggers first prompt.

Basically you'll need to use MsgBox and SaveAs. Familiar with that?

something like

Sub Report ()

Dim Nm as String

If MsgBox ("Do you want to create report?", vbQuestion + vbYesNo)
vbYes Then

'create new Wb
'copy Ws to new Wb

newWb.SaveAs (Filename:= "" & Now, etc... look into XL help fo
details)

Nm = newWb.Name

MsgBox "New report created and saved as " & Nm

EndIf

You should refer to XL help for creating a new Wb (can't remembe
exactly how right now, maybe Application.Workbooks.Add?)

Did that help

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving and copying results

Sorry by this:

'create new Wb
'copy Ws to new Wb

I meant "here is your code to do this". Check Help for details on ho
to create a new Wb and copy Worksheets

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving and copying results

Here is what ive done so far:
Sub Report()


Dim Nm As String
If MsgBox("Do you want to create report?", vbQuestion + vbYesNo)
vbYes Then

Set newBook = Workbooks.Add
With newBook
.Title = "Report" & Now()
.SaveAs Filename:="Report" & Now()

Nm = newWb.Name
MsgBox "New Report Created and Saved As" & Nm

End If

Think ive missed somthing out and im not too sure about vba can anyon
help

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Saving and copying results

Sub Report()

Dim Nm As String, newBook As Workbook, ThisBook As Workbook

If MsgBox("Do you want to create report?", vbQuestion + vbYesNo) =
vbYes Then

Set ThisBook = ActiveWorkbook
Set newBook = Workbooks.Add
Nm = Day(Now) & "_" & Month(Now) & "_" & Year(Now) & Time

With newBook
..SaveAs FileName:="C:\Destop\Report\" & Nm

'code for copy sheets from ThisBook to newBook here

End With

MsgBox "New Report Created and Saved As" & Workbooks(Nm).Name

Set newBook = Nothing
Set ThisBook = Nothing

End If

End Sub

You just needed to End With. And also when using Object variable (eg Wb
variables), ALWAYS Set it back to Nothing, or you could have some
surprises. Object variables can creat all sorts of troubles.

Hope this works, I haven't had time to test it and I'm still a beginner
really...


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

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
Saving Excel Pro 2003 iteration results Tunja Excel Discussion (Misc queries) 9 September 15th 09 03:15 PM
COPYING AND SAVING THE INFORMATION YESHWANT JOSHI[_2_] Excel Discussion (Misc queries) 5 July 22nd 09 03:07 PM
copying formulas-displaying results TLGbetsy Excel Discussion (Misc queries) 1 June 28th 09 12:52 AM
column copying and saving hachiroku Excel Discussion (Misc queries) 2 May 2nd 06 01:20 PM
Copying RESULTS of a FORMULA to another worksheet Scott Howell Excel Programming 2 November 21st 03 10:46 PM


All times are GMT +1. The time now is 01:47 PM.

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"