HTFC Forums

H.T.F.C.

How To Fix Computers





Go Back   HTFC Forums > Software Newsgroups > Microsoft Office

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1  
Old 12-14-2007, 05:24 AM
jatman
 
Posts: n/a
Default help in updating macro to office excel 2007 - macro enabled workbo

good morning,

i compiled this macro for office 2003 with help from users here, and now i'm
back again because we have upgraded to office 2007. i have also changed the
file to office 2007 - macro enabled.

the following macro, sends a copy of the excel sheet, then saves a copy in
pdf format (using the MS add-in) and goes through a few other things as you
will see. i need two things in this macro, and i have those items [IN THIS
FORMAT - ALL CAPS]


Sub POInv()
' Macro recorded 8/28/2006 by Jat
'
If ActiveSheet.Name = "Purchase Order (Inventory)" Then
'Sub SaveName() - multiple steps
ActiveSheet.Copy 'creates a new one page workbook with a copy of
the activesheet in it, this becomes the activesheet/book
ActiveSheet.Name = Range("L5").Value 'renames the active sheet
(from ActiveSheet.Copy) to the purchase order value located in cell M5 [I
WOULD LIKE THE SHEET NAME TO INCLUDE THE SUPPLIER NAME IN CELL D11. I have
tried adding the cell d11 into the activesheet.name range but i cannot figure
it out.]
Range("L7") = Now
strdate = Format(Now, "mm-dd-yy h-mm-ss")
ActiveSheet.Protect
'End Sub

'Sub Email() - sends a copy of the email to the recipients in an excel
format(should be accounts payable department, or similar)
ActiveWorkbook.SendMail Recipients:="ap@myemailaccount.ca",
Subject:=ActiveSheet.Name

[IN THE EMAIL, THE EXCEL ATTACHMENT'S NAME IS BOOK1.XLSX. I WOULD LIKE THE
ATTACHMENT'S NAME TO BE THE SAME AS THE ACTIVESHEET.NAME. I tried
Attachment:=ActiveSheet.Name but not that easy.]

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Jat\Desktop\Operations\Purchase Orders\Purchase Orders
Issued\" & ActiveSheet.Name & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True,
IgnorePrintAreas _
:=False, OpenAfterPublish:=False

ActiveWorkbook.Close SaveChanges:=False 'don't ask - kind of looks
good.
'End Sub Email()

'Sub Count() 'increases the PO number (stored in cell K8 and
displayed in M5)
mycount = Range("K8") + 1
Range("K8") = mycount
'End Sub

'Sub ClearContents() - Clears the contents in selectable cells, and
reverts the actual PO to it's original form

Range("L9,L11,L13,L15,D11:G15,A18:K38,E39,G39,J39, C41,E41,H41,B43:K46,L50,A51:G51,F5:H8").Select
Selection.ClearContents
Range("B18:I18").Select
Range("B18:I18").Select
Selection.Copy

Range("B38:I38").Select
ActiveSheet.Paste
Application.ScreenUpdating = True
Range("D11:G11").Select
'End Sub

'Sub AutoSave() - saves the updated purchase order
ActiveWorkbook.Save
'End Sub

End If

End Sub


well, that's it. just two simple things to keep the macro simple. any help
would be appreciated.

thank you,

jat jaswal

Reply With Quote
Sponsored Links
Fix your Windows Problems - FAST.
FREE Safe Scan Registry Check. Locate & Fix Errors in Minutes!
Reply


Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Office 2007 macro problem Jeanette Microsoft Office 0 10-14-2007 07:07 AM
Office 97 macro doesn't work Hidetoshi Junior Windows Vista 7 07-12-2007 01:40 AM
how do i share an excel macro? raseron Microsoft Office 2 05-30-2007 09:41 PM
(2007) Excel macro blocks Outlook??? C. Moya Microsoft Office 15 04-30-2007 04:18 PM
Excel -Macro Tina Microsoft Office 0 04-05-2007 03:47 PM


All times are GMT. The time now is 06:32 PM.


Powered by vBulletin® Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004 - 2007 Web-S-Sense Pty. Ltd. Usenet and forums posts © their respective authors.
Ad Management by RedTyger