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

I am trying to create a macro that will create a report from the current open
file. i want it to create a new workbook and save it as the contents of a
cell in the current workbook. Here is the very rough beginings of the macro,
but i dont know how to get it to do what i want.

Sub report()
Workbooks.Add
ChDir "C:\Documents and Settings\tim\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\tim\Desktop\Book1.xls", FileFormat:
=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("B4").Select
ActiveCell.FormulaR1C1 = "=[Book2]Sheet1!R1C1"
Range("B5").Select
End Sub

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Creating Report

Sub report()
Dim bk as Workbook
Dim sname as String
set bk = Activeworkbook
sName = Range("B9").Value
if sname = "" then exit sub
Workbooks.Add
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\tim\Desktop\" & _
sname & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("B4").Select
' linking formula back to the original workbook?
ActiveCell.FormulaR1C1 = "=[" & _
bk.name & "]Sheet1!R1C1"
Range("B5").Select
End Sub

--
Regards,
Tom Ogilvy

"brownti via OfficeKB.com" wrote:

I am trying to create a macro that will create a report from the current open
file. i want it to create a new workbook and save it as the contents of a
cell in the current workbook. Here is the very rough beginings of the macro,
but i dont know how to get it to do what i want.

Sub report()
Workbooks.Add
ChDir "C:\Documents and Settings\tim\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\tim\Desktop\Book1.xls", FileFormat:
=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Range("B4").Select
ActiveCell.FormulaR1C1 = "=[Book2]Sheet1!R1C1"
Range("B5").Select
End Sub

--
Message posted via http://www.officekb.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
Creating an overdue report. AVCM New Users to Excel 2 October 1st 09 08:43 AM
Creating a Report Pat Excel Discussion (Misc queries) 1 March 15th 09 05:33 PM
creating an aging report PSikes Excel Worksheet Functions 10 December 17th 06 03:52 PM
Creating a Subset Report Bob Excel Worksheet Functions 2 November 13th 06 03:52 PM
Creating a report by For Each... Stef Excel Programming 8 February 18th 05 01:53 PM


All times are GMT +1. The time now is 12:17 AM.

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"