Cupid Stunt
Member
- Outlook version
- Email Account
- Exchange Server
Hi,
I'm very new to VBA, I've just started working with Excel VBA and finding it incredibly useful but this is the first time I've tried anything in outlook and I'm stuck already on something I hoped was just very small and simple...
I have an excel sheet that contains a unique number that I need to change anytime someone runs any one of various Macros I have in different Excel sheets. What I now want to do is create a macro for Outlook that will open the excel file increase the cell value by 1 copy the cell contents paste this into the current active email without losing any of its contents and then save and close the excel file.
Also I need it to work in both Outlook 2007 & Outlook 2003
So far I have
This copies the data I need but I can't find a way to paste it into the active email.
I can only paste it manually
Also I've had to quote out the last line
Workbooks("CurrentNumber.xlsx").Close
because as soon as this runs I lose the data copied to the clipboard.
Any assistance anyone could offer would be most appreciated.
Thanks
I'm very new to VBA, I've just started working with Excel VBA and finding it incredibly useful but this is the first time I've tried anything in outlook and I'm stuck already on something I hoped was just very small and simple...
I have an excel sheet that contains a unique number that I need to change anytime someone runs any one of various Macros I have in different Excel sheets. What I now want to do is create a macro for Outlook that will open the excel file increase the cell value by 1 copy the cell contents paste this into the current active email without losing any of its contents and then save and close the excel file.
Also I need it to work in both Outlook 2007 & Outlook 2003
So far I have
Code:
Sub test()
Workbooks.Open ("E:\Users\Cupid Stunt\Desktop\CurrentNumber.xlsx")
Workbooks("CurrentNumber.xlsx").Sheets("Sheet1").Range("A1").Value = Workbooks("CurrentNumber.xlsx").Sheets("Sheet1").Range("A1").Value + 1
Workbooks("CurrentNumber.xlsx").Save
Workbooks("CurrentNumber.xlsx").Sheets("Sheet1").Range("A1").Copy
'Workbooks("CurrentNumber.xlsx").Close
End Sub
This copies the data I need but I can't find a way to paste it into the active email.
I can only paste it manually
Also I've had to quote out the last line
Workbooks("CurrentNumber.xlsx").Close
because as soon as this runs I lose the data copied to the clipboard.
Any assistance anyone could offer would be most appreciated.
Thanks