Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA Excel Help - Filename

I am trying to do the following: I am using excel and I have a
checkbox and once that box is checked I want it to see if it has been
saved if not then i want the "Save as" method to show but if the file
has already been saved then I want it to just the save the changes and
not show the "Save As" dialog every time the check box is checked


The following is the code i am working: any ideas on what i may be
doing worng???


Sub CheckBox1_Click()
Dim amessage As Outlook.MailItem
Dim test As String
Dim filename As String


If Not ActiveWorkbook.Saved Then
filesavename = Excel.Application.GetSaveAsFil*ename( _
filefilter:="Excel Files (*.xls), *.xls")
ThisWorkbook.SaveAs filename:=filesavename


End If


If ThisWorkbook.Saved = True Then
test = inputbox("Please enter an email address:")
Set outsess = CreateObject("outlook.Applicat*ion")
Set amessage = outsess.CreateItem(olMailItem)
amessage.BodyFormat = olFormatHTML
amessage.To = test
'more code but didnt display it all
End if

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default VBA Excel Help - Filename

If Not ActiveWorkbook.Saved Then
If ActiveWorkbook.Path = "" Then
filesavename = Excel.Application.GetSaveAsFil*ename( _
filefilter:="Excel Files (*.xls), *.xls")
ThisWorkbook.SaveAs filename:=filesavename
Else
ActiveWorkbook.Save
End If
End If

--

Vasant


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
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
returning filename in excel Claud Balls Excel Programming 4 February 2nd 05 10:48 PM
Excel Filename prgramatically Mike D[_3_] Excel Programming 4 April 16th 04 07:18 PM
Saving filename same as import filename Matt Excel Programming 4 February 24th 04 03:01 PM


All times are GMT +1. The time now is 01:43 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"