[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Vba/vb6 Save as specefic sheet after edit

Posted on 2016-10-01
11
Medium Priority
?
46 Views
Last Modified: 2016-10-29

As-Salam Alaikom.

I'am using excell 2007 .


I  have userform to open specefic workbook and entry data on it.  I want after entry data in specefic sheet then Save a that sheet in (C:\file)  and manuel name..  

Saved file only data without format. ( formulaire)

:)

Any Idea?  

0
Comment
Question by:Nassim am
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 35

Expert Comment

by:ste5an
ID: 41824980
Well, it's hard to tell what you all need:

Sheets("SheetName").Range("A1").Value = "Some text"
ActiveWorkbook.Save "Path\Filename.xlsx")

Open in new window

1
 

Author Comment

by:Nassim am
ID: 41824994
Hi again..  I already fill data in tablr only i want the save as buttom should open thz dialog file on (C:\file) where to to save it and  user write the name of file...
0
 
LVL 9

Expert Comment

by:Koen
ID: 41825288
opening the save as dialog is the easy part...

Application.GetSaveAsFilename

this instruction will do that...the question is, how/when do you want this to happen ?
1
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:Nassim am
ID: 41825341
Thx Koen.

My userform is simple

1 buttom to fill data in specifi cells

.Range("a1").value = textbox1.value

2- buttom to print the sheet

Sheets("test").PrintOut

3- buttom to save as the sheet As an archive in c:\file

( save as specefic sheet (test)  with saveas dialog wich give me the permessn to choose where to save and file name)
0
 
LVL 9

Expert Comment

by:Koen
ID: 41825359
so, when you create the button it prompts you for a macro, click new and the developer window will open on a macro Sub ButtonX_Click() where X is a number dependent of the number of buttons you have.

In the macro write
Application.GetSaveAsFilename

done !

Sub Button1_Click()

    Application.GetSaveAsFilename

End Sub

Open in new window

1
 

Author Comment

by:Nassim am
ID: 41830182
#Koen

It open the saveas dialog but when i save the file..  It doesn't apper in the distination


Can i declare wish sheet to save as??  

For excamplr..  Sheeet1 . Sheet2 . Sheet3

Can i make the button saveas only the sheet3 ??
0
 

Author Comment

by:Nassim am
ID: 41830416
The first command is

Sheets("test").Printout

I want after printing this sheet.. Saving it :)
automaticly after printung or in auther button..  The both is accepted
0
 
LVL 9

Expert Comment

by:Koen
ID: 41831262
calling the save dialog from code is the same as when you hit the button... If you select a folder and save it there, it should show up afterwards...

then, next, you have to decide... either we call the save dialog box (giving the user the possibility to save however and where ever he wants) or we save it through code, where you decide what will be save and where it will be saved.

you can save only one sheet (or a selection of sheets), you can also move it to a new book (to get rid of the macro's) and save that one...

let me know what exactly you want...
0
 
LVL 9

Accepted Solution

by:
Koen earned 2000 total points (awarded by participants)
ID: 41831266
Here is how I usually handle the saving of one or more sheets (and losing the macro's):

Dim MySheetNames() as string    'array to hold the sheet names

MySheetNames(0)= Firstsheet
MySheetNames(1)= secondsheet 'you have to put the value in somewhere in your code

' copy sheets and save
Sheets(MySheetNames).Select
MyFilename = "All Project Fiches " & Format(Date, "yyyymmdd") & ".xlsx"
Sheets(MySheetNames).Copy
Workbooks("originalfilewithcode.xlsm").Close
ActiveWorkbook.SaveAs Filename:=MyFilename, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

Open in new window

0
 
LVL 9

Expert Comment

by:Koen
ID: 41858238
I think it's fair tot say that I answered the question...
1
 

Author Comment

by:Nassim am
ID: 41865241
Sorry i lost connection for lo'g time brother..  Thank you very mush :) Allah bless you :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question