68 Classifieds Forums

Excel Help Part 2

This is a discussion on Excel Help Part 2 within the Off Topic forums, part of the General category; Hi, For my project i have another hurdle. I need to make a button that will open save as, is ...


Go Back   68 Classifieds Forums > General > Off Topic

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 08-27-2008, 04:04 AM
bowers01's Avatar
Senior Member
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 582
Rep Power: 14
bowers01 is on a distinguished road
Question Excel Help Part 2

Hi,
For my project i have another hurdle. I need to make a button that will open save as, is this possible?

If it is then theres a second question.
I currently have the date in a cell that auto updates. Is it going to be possible to make it save as the date or what ever is in the certain cell?
Any help would be great.

Maybe Mike the Excel Counselor could help me again

Cheers,
Nick

__________________
Nick Bowers
68c v4.09 Developer
Reply With Quote
  #2  
Old 08-28-2008, 05:00 AM
bowers01's Avatar
Senior Member
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 582
Rep Power: 14
bowers01 is on a distinguished road
Default

Hi,
I have worked out the following:
Code:
Sub Button6_Click()
ThisWorkbook.Save
ThisWorkbook.Close
End Sub
But i still need to make it save as a certain name, is there a command to put on the end of ThisWorkbook.Save to make it save as a field name?
Cheers,
Nick
__________________
Nick Bowers
68c v4.09 Developer
Reply With Quote
  #3  
Old 08-28-2008, 05:36 AM
Member
 
Join Date: Dec 2006
Posts: 96
Rep Power: 10
objelland is on a distinguished road
Default

Hi
You can try this:

Quote:
Sub SaveAsCell()

Dim strName As String



On Error GoTo InvalidName

strName = Sheet1.Range("A1")

ActiveWorkbook.SaveAs strName



Exit Sub

InvalidName: MsgBox "The text: " & strName & _

" is not a valid file name.", vbCritical, "Ozgrid.com"

End Sub
__________________
objelland
V3.1.5b Developer
Reply With Quote
  #4  
Old 08-28-2008, 05:43 AM
bowers01's Avatar
Senior Member
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 582
Rep Power: 14
bowers01 is on a distinguished road
Default

Hi,
I did that and get this error:
http://everythingsfree.org/image//im...18792excel.jpg
Any idea why?
Cheers
__________________
Nick Bowers
68c v4.09 Developer
Reply With Quote
  #5  
Old 08-28-2008, 07:01 AM
bowers01's Avatar
Senior Member
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 582
Rep Power: 14
bowers01 is on a distinguished road
Default

Hi,
I also found this code. It seems to do the same thing but i get an error saying "Compile error" http://everythingsfree.org/image//im...5509excel2.jpg
Quote:
Sub Button1_Click()

ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & strName
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Cat Nos").Visible = True
Sheets("Supplier Info").Visible = True
Sheets("Codes").Visible = True
Sheets("Buyers").Visible = True
Sheets(Array("Data Sheet", "Sup No Lookup", "Buyer lookup", "Cat Nos", _
"Supplier Info", "Codes", "Buyers")).Select
Sheets("Buyers").Activate
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.Delete


Dim strName As String

On Error GoTo InvalidName
strName = Sheet2.Range("F14")
ActiveWorkbook.SaveAs strName

Exit Sub
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, "Ozgrid.com"
End Sub
Any idea why this might not work? or ideas on how to fix the post above?
Cheers,
Nick
__________________
Nick Bowers
68c v4.09 Developer
Reply With Quote
  #6  
Old 08-29-2008, 04:33 AM
Member
 
Join Date: Dec 2006
Posts: 96
Rep Power: 10
objelland is on a distinguished road
Default

I cant see why you are getting the error message, but I can see that you are refering to the variable strName in the first line of your code, without declaring it. You are declaring the variable at line 18 or so (Dim strName As String). Move that line to the top of your code! That might help!

Cheers!
__________________
objelland
V3.1.5b Developer
Reply With Quote
  #7  
Old 08-29-2008, 08:08 AM
bowers01's Avatar
Senior Member
 
Join Date: May 2008
Location: Geelong, Victoria, Australia
Posts: 582
Rep Power: 14
bowers01 is on a distinguished road
Default

Hi,
Thanks for the help but i get another error.
http://everythingsfree.org/image//im...58110excel.jpg
Any ideas?
Nick
__________________
Nick Bowers
68c v4.09 Developer
Reply With Quote
  #8  
Old 08-29-2008, 04:37 PM
Mike-N-Tosh's Avatar
Moderator
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 996
Rep Power: 30
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

It would seem to be that since you are using the current file path and then concatenating "\" & the string name then it is expecting to find a directory with the name of the "stringname"

example:
current file path = mycomputer\documents\excel\myproject

New file path in your code = mycomputer\documents\excel\\newfilename

Try getting rid of the extra "\" OR create another directory for the save as files and include that after the "\" & "mysavedprojectfiles" & ...

-Mike
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0, 4.0.1, 4.0.4, 4.0.8, 4.1b3

Templates for sale | 68 Classifieds Customizations | My blog on 68
Web Hosting | Web Design & Development
I am not a 68C employee, just a user and try to help out
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
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
Help your customers pay for ads in Not Completed status civ v3.1 Modules & Modifications 39 10-06-2008 03:19 AM
Excel Help Needed bowers01 Off Topic 2 08-19-2008 05:31 AM
SEO _ to - From The "Experts" CB v3.1 Questions & Support 19 01-19-2008 02:55 PM
CSV & Microsoft Excel Maffo Off Topic 9 12-04-2007 04:27 PM


All times are GMT -4. The time now is 07:41 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22