Technology Questions

Go Back   Technology Questions > Software Questions > General Questions > Microsoft Office

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 12-13-2007, 09:30 PM
jatman
Newsgroup Contributor
 
Posts: n/a
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 12-13-2007, 09:30 PM
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
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
Office 2007 macro problem Jeanette Microsoft Office 0 10-13-2007 11:10 PM
how do i share an excel macro? raseron Microsoft Office 2 05-30-2007 01:50 PM
(2007) Excel macro blocks Outlook??? C. Moya Microsoft Office 20 05-05-2007 03:47 PM
Excel -Macro Tina Microsoft Office 0 04-05-2007 07:45 AM
Envelopes fom Excel w/macro? al Microsoft Office 1 03-12-2007 09:01 AM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 07:18 AM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0