Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default creating new folder while saving document

I am trying to create a command, that when clicked will print out a boo
twice and save it. It needs to create a new folder in the directory.
The Name of the folder, needs to be what is in Text Box 1. This i
what I currently have. Can someone point me in the right direction?


Private Sub CommandButton1_Click()
Unload Me
ActiveWorkbook.PrintOut
ChDir "\\Pkcfp009\Mait_e&d\NewHireDocumentation\La
Forms\Transition to Success\"
Dim NameOFile$
NameOFile = TextBox2.Text
ThisWorkbook.SaveAs NameOFile & ".xls"
ChDir "%USERPROFILE%\Transition to Success Plans\"
Dim NameOFile$
NameOFile = TextBox2.Text
ThisWorkbook.SaveAs NameOFile & ".xls"
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default creating new folder while saving document

Also,

When it saves it, it is not saving the actual excel workbook. It i
renaming the userform and saving that. How do I tell it to save th
file that it was sending the info to. I've tried calling up th
workbook then saving it, but it still doesnt work

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default creating new folder while saving document

On Thu, 17 Jun 2004 21:49:41 -0500, dok112
wrote:

I am trying to create a command, that when clicked will print out a book
twice and save it. It needs to create a new folder in the directory.
The Name of the folder, needs to be what is in Text Box 1. This is
what I currently have. Can someone point me in the right direction?


Private Sub CommandButton1_Click()
Unload Me
ActiveWorkbook.PrintOut
ChDir "\\Pkcfp009\Mait_e&d\NewHireDocumentation\Lab
Forms\Transition to Success\"
Dim NameOFile$
NameOFile = TextBox2.Text
ThisWorkbook.SaveAs NameOFile & ".xls"
ChDir "%USERPROFILE%\Transition to Success Plans\"
Dim NameOFile$
NameOFile = TextBox2.Text
ThisWorkbook.SaveAs NameOFile & ".xls"
End Sub


Okay, so, TextBox1 is the new folder, and TextBox2 is a new filename?
How about this:
newFolder$ = "full\path\to\new\folder\" & TextBox1.Text
MkDir newFolder$
newFile$ = newFolder$ & "\" & TextBox2.Text & ".xls"
ThisWorkbook.SaveAs newFile$

--
auric underscore underscore at hotmail dot com
*****
Sweet Virgin Mary's tampon!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default creating new folder while saving document

This works great!! Only problem, it is saving the userform file, no
the actual document. Basically, I am using a userform to inser
information multiple times in a .xls file. When it's done, I need t
save it the file (TextBox2.Text) and the filename (TextBox1.Text). Bu
I need to save the document, not the userfile. How do I do this

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 538
Default creating new folder while saving document

On Mon, 21 Jun 2004 09:40:24 -0500, dok112
wrote:

This works great!! Only problem, it is saving the userform file, not
the actual document. Basically, I am using a userform to insert
information multiple times in a .xls file. When it's done, I need to
save it the file (TextBox2.Text) and the filename (TextBox1.Text). But
I need to save the document, not the userfile. How do I do this?


So, instead of giving you a .xls file, you're getting a .frm file? If
so, that's... weird... I didn't know you could do that... As for solving
that, beats the heck outta me.
--
auric underscore underscore at hotmail dot com
*****
Caffeine makes the world go round.
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
Saving a workbook by creating a folder & subfolder Gaura215 Excel Worksheet Functions 0 February 1st 11 10:47 AM
document information from folder Joe Excel Discussion (Misc queries) 0 March 15th 10 06:33 PM
Templates - saving in specified folder Kathrine Excel Discussion (Misc queries) 4 October 30th 08 04:02 PM
Saving file to a specific folder richkim2000 Excel Discussion (Misc queries) 1 January 25th 05 11:11 PM
Specify a folder for saving to?!?! solo_razor[_12_] Excel Programming 1 October 28th 03 10:14 AM


All times are GMT +1. The time now is 01:00 AM.

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

About Us

"It's about Microsoft Excel"