ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Saveas Macro (https://www.excelbanter.com/excel-discussion-misc-queries/25497-saveas-macro.html)

Nigel

Saveas Macro
 
Hi,
i have a code that prints a range as a jpg, opens outlook and puts it in.
What i need it to do is name itself as the filename to which it is created in.
Example:
c/data/excel/1234 myclient.xls ( file it is to be created in)
i would like it to name itself 1234 myclient.jpg

it doesnt save anywhere, only as an attachement but it needs a name. i can
alter the code and give it a standard name like Quote.jpg but when you send
alot to the same person and they save the attachment, they all have the same
name so this is why i need the change. Can this be acheived?

REgards,

Nigel

Bob Phillips

If you don't save it, you can't name it, as that is how it gets its name.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
Hi,
i have a code that prints a range as a jpg, opens outlook and puts it in.
What i need it to do is name itself as the filename to which it is created

in.
Example:
c/data/excel/1234 myclient.xls ( file it is to be created in)
i would like it to name itself 1234 myclient.jpg

it doesnt save anywhere, only as an attachement but it needs a name. i can
alter the code and give it a standard name like Quote.jpg but when you

send
alot to the same person and they save the attachment, they all have the

same
name so this is why i need the change. Can this be acheived?

REgards,

Nigel




Nigel

Hi Bob,
in the code, i put a general name which is the same whatever. Do i have to
save it in order to give it a name?
Regs,

Nigel

"Bob Phillips" wrote:

If you don't save it, you can't name it, as that is how it gets its name.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
Hi,
i have a code that prints a range as a jpg, opens outlook and puts it in.
What i need it to do is name itself as the filename to which it is created

in.
Example:
c/data/excel/1234 myclient.xls ( file it is to be created in)
i would like it to name itself 1234 myclient.jpg

it doesnt save anywhere, only as an attachement but it needs a name. i can
alter the code and give it a standard name like Quote.jpg but when you

send
alot to the same person and they save the attachment, they all have the

same
name so this is why i need the change. Can this be acheived?

REgards,

Nigel





Bob Phillips

Nigel,

The attachment is a file on the disk, so youn could rename that just prior
to attaching, then rename back.

Something like

oldFile = "C:\Documents And Settings\Nigel\My Documents\myFile.xls"
Application.DisplayAlerts = False
NewFile = Left(oldFile, Len (oldFile-3))
Name OldFile as Newfile
' do you Outlook stuff
Name NewFile as oldFile
Application.DisplayAlerts = True

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
Hi Bob,
in the code, i put a general name which is the same whatever. Do i have to
save it in order to give it a name?
Regs,

Nigel

"Bob Phillips" wrote:

If you don't save it, you can't name it, as that is how it gets its

name.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Nigel" wrote in message
...
Hi,
i have a code that prints a range as a jpg, opens outlook and puts it

in.
What i need it to do is name itself as the filename to which it is

created
in.
Example:
c/data/excel/1234 myclient.xls ( file it is to be created in)
i would like it to name itself 1234 myclient.jpg

it doesnt save anywhere, only as an attachement but it needs a name. i

can
alter the code and give it a standard name like Quote.jpg but when you

send
alot to the same person and they save the attachment, they all have

the
same
name so this is why i need the change. Can this be acheived?

REgards,

Nigel








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com