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

Hi everyone,

I know how to save a spreadsheet using VBA, but I want to move/copy the file
after it has been saved, is this possible?

I am creating a system where spreadsheets get dropped into an Inbox folder
(e.g. c:\Inbox) folder and then moved or copied to an Outbox folder (e.g.
c:\Outbox), once they have been edited and saved.

I wish to attached some code to a button that saves the spreadsheet and then
prompts the user (with a dialogue box), asking if they want to move or copy
the folder to the outbox, and then close the file down.

I understand that the move may not be possible, as the file is stil open,
but the copy (save as) will be possible.

Any help would be much appreciated.

Also, is it possible to save MS word files through excel VBA code??

Thanks in Advance.

Pinda.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Saving using VBA

Look at the NAME function.

On Sat, 6 Nov 2004 16:08:02 -0800, "Pinda"
wrote:

Hi everyone,

I know how to save a spreadsheet using VBA, but I want to move/copy the file
after it has been saved, is this possible?

I am creating a system where spreadsheets get dropped into an Inbox folder
(e.g. c:\Inbox) folder and then moved or copied to an Outbox folder (e.g.
c:\Outbox), once they have been edited and saved.

I wish to attached some code to a button that saves the spreadsheet and then
prompts the user (with a dialogue box), asking if they want to move or copy
the folder to the outbox, and then close the file down.

I understand that the move may not be possible, as the file is stil open,
but the copy (save as) will be possible.

Any help would be much appreciated.

Also, is it possible to save MS word files through excel VBA code??

Thanks in Advance.

Pinda.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Saving using VBA

Pinda,

You have a number of options.

Personally, I would ask the question before saving and than take the action.
So if they say, Copy, you can do a SaveAs. If they say move, you can do a
Save and a Name, or a Saveas and a Kill on the file in c:\Inbox.

As to saving a word doc, not directly, as Excel saves Excel and various text
formats. Why would you open a word doc in Excel anyway. If you must process
a Word doc from Excel VBA the 'normal' way is to use automation, which means
running an instance of Word from within your Excel VBA, and use that
instance to manipulate the Word file.
--

HTH

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


"Pinda" wrote in message
...
Hi everyone,

I know how to save a spreadsheet using VBA, but I want to move/copy the

file
after it has been saved, is this possible?

I am creating a system where spreadsheets get dropped into an Inbox folder
(e.g. c:\Inbox) folder and then moved or copied to an Outbox folder (e.g.
c:\Outbox), once they have been edited and saved.

I wish to attached some code to a button that saves the spreadsheet and

then
prompts the user (with a dialogue box), asking if they want to move or

copy
the folder to the outbox, and then close the file down.

I understand that the move may not be possible, as the file is stil open,
but the copy (save as) will be possible.

Any help would be much appreciated.

Also, is it possible to save MS word files through excel VBA code??

Thanks in Advance.

Pinda.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Saving using VBA

Bob,

Thanks for that, the save as and kill option sounds good. but will the kill
function work if the file is still open or does it execute when file is
closed?

How would I code something like that, including a dialogue box? My VBA
skills are only basic.

Thanks for your help.

Pinda.

"Bob Phillips" wrote:

Pinda,

You have a number of options.

Personally, I would ask the question before saving and than take the action.
So if they say, Copy, you can do a SaveAs. If they say move, you can do a
Save and a Name, or a Saveas and a Kill on the file in c:\Inbox.

As to saving a word doc, not directly, as Excel saves Excel and various text
formats. Why would you open a word doc in Excel anyway. If you must process
a Word doc from Excel VBA the 'normal' way is to use automation, which means
running an instance of Word from within your Excel VBA, and use that
instance to manipulate the Word file.
--

HTH

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


"Pinda" wrote in message
...
Hi everyone,

I know how to save a spreadsheet using VBA, but I want to move/copy the

file
after it has been saved, is this possible?

I am creating a system where spreadsheets get dropped into an Inbox folder
(e.g. c:\Inbox) folder and then moved or copied to an Outbox folder (e.g.
c:\Outbox), once they have been edited and saved.

I wish to attached some code to a button that saves the spreadsheet and

then
prompts the user (with a dialogue box), asking if they want to move or

copy
the folder to the outbox, and then close the file down.

I understand that the move may not be possible, as the file is stil open,
but the copy (save as) will be possible.

Any help would be much appreciated.

Also, is it possible to save MS word files through excel VBA code??

Thanks in Advance.

Pinda.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Saving using VBA

Hi Pinda,

No, Kill will throw up a permission s error if you have it open, but that is
manageable. Try this

Dim sMess As String
Dim sPath As String
Dim ans

sMess = "Do you want to Move, Copy, or nothing" & vbCrLf & vbCrLf & _
"Press Yes to move, No to Copy, or Cancel to quit"
ans = MsgBox(sMess, vbYesNoCancel, "File Manage")
If ans = vbYes Then
sPath = ActiveWorkbook.FullName
ActiveWorkbook.SaveAs "C:\Outbox\" & ActiveWorkbook.Name
ActiveWorkbook.Close
Kill sPath
ElseIf ans = vbNo Then
ActiveWorkbook.Save
ActiveWorkbook.SaveAs "C:\Outbox\" & ActiveWorkbook.Name
End If

--

HTH

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


"Pinda" wrote in message
...
Bob,

Thanks for that, the save as and kill option sounds good. but will the

kill
function work if the file is still open or does it execute when file is
closed?

How would I code something like that, including a dialogue box? My VBA
skills are only basic.

Thanks for your help.

Pinda.

"Bob Phillips" wrote:

Pinda,

You have a number of options.

Personally, I would ask the question before saving and than take the

action.
So if they say, Copy, you can do a SaveAs. If they say move, you can do

a
Save and a Name, or a Saveas and a Kill on the file in c:\Inbox.

As to saving a word doc, not directly, as Excel saves Excel and various

text
formats. Why would you open a word doc in Excel anyway. If you must

process
a Word doc from Excel VBA the 'normal' way is to use automation, which

means
running an instance of Word from within your Excel VBA, and use that
instance to manipulate the Word file.
--

HTH

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


"Pinda" wrote in message
...
Hi everyone,

I know how to save a spreadsheet using VBA, but I want to move/copy

the
file
after it has been saved, is this possible?

I am creating a system where spreadsheets get dropped into an Inbox

folder
(e.g. c:\Inbox) folder and then moved or copied to an Outbox folder

(e.g.
c:\Outbox), once they have been edited and saved.

I wish to attached some code to a button that saves the spreadsheet

and
then
prompts the user (with a dialogue box), asking if they want to move or

copy
the folder to the outbox, and then close the file down.

I understand that the move may not be possible, as the file is stil

open,
but the copy (save as) will be possible.

Any help would be much appreciated.

Also, is it possible to save MS word files through excel VBA code??

Thanks in Advance.

Pinda.








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
Automaticly saving formula's to values when saving Gunti Excel Discussion (Misc queries) 8 November 11th 08 09:34 AM
A: saving Curt Excel Discussion (Misc queries) 5 April 11th 07 04:10 AM
Saving fak119 Excel Discussion (Misc queries) 1 August 28th 06 08:36 AM
Saving a Workbook: Forcing User to Rename before Saving Rollin_Again[_6_] Excel Programming 5 April 16th 04 02:54 PM
saving a ss peter Excel Programming 1 August 15th 03 03:13 AM


All times are GMT +1. The time now is 07:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"