Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Problem: vba code for creating a button to save worksheet as Cell


Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub


I have created a button that would save the worksheet as the value in cell A1.
I keep getting an error with the above code. Can someone point out where I
am going wrong , and suggest an alternative way of coding for this cmd.
Thanks,

Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Problem: vba code for creating a button to save worksheet as Cell

What's the value in A1?

If you put the date in there, remember that you can't use slashes in
filenames--at least in Windows.

caldog wrote:

Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub

I have created a button that would save the worksheet as the value in cell A1.
I keep getting an error with the above code. Can someone point out where I
am going wrong , and suggest an alternative way of coding for this cmd.
Thanks,

Steve


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Problem: vba code for creating a button to save worksheet as C

Always the word 'Current' and then a three digit number, with no slashes or
hyphens in it or spaces.

Example: 'Current112'

Steve

"Dave Peterson" wrote:

What's the value in A1?

If you put the date in there, remember that you can't use slashes in
filenames--at least in Windows.

caldog wrote:

Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub

I have created a button that would save the worksheet as the value in cell A1.
I keep getting an error with the above code. Can someone point out where I
am going wrong , and suggest an alternative way of coding for this cmd.
Thanks,

Steve


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Problem: vba code for creating a button to save worksheet as C

Maybe you're looking at the wrong worksheet?

ThisFile = activeworkbook.worksheets("Sheet1").Range("A1").Va lue

If that doesn't help, maybe you can post the exact error you get.



caldog wrote:

Always the word 'Current' and then a three digit number, with no slashes or
hyphens in it or spaces.

Example: 'Current112'

Steve

"Dave Peterson" wrote:

What's the value in A1?

If you put the date in there, remember that you can't use slashes in
filenames--at least in Windows.

caldog wrote:

Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub

I have created a button that would save the worksheet as the value in cell A1.
I keep getting an error with the above code. Can someone point out where I
am going wrong , and suggest an alternative way of coding for this cmd.
Thanks,

Steve


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Problem: vba code for creating a button to save worksheet as Cell



Public Sub SaveAsA1()

Activeworkbook.SaveAs (Range("A1"))

End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Problem: vba code for creating a button to save worksheet as C

This is the error message I get:

[ Run-time error '91': Object variable or With block variable not set ]



"Dave Peterson" wrote:

Maybe you're looking at the wrong worksheet?

ThisFile = activeworkbook.worksheets("Sheet1").Range("A1").Va lue

If that doesn't help, maybe you can post the exact error you get.



caldog wrote:

Always the word 'Current' and then a three digit number, with no slashes or
hyphens in it or spaces.

Example: 'Current112'

Steve

"Dave Peterson" wrote:

What's the value in A1?

If you put the date in there, remember that you can't use slashes in
filenames--at least in Windows.

caldog wrote:

Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub

I have created a button that would save the worksheet as the value in cell A1.
I keep getting an error with the above code. Can someone point out where I
am going wrong , and suggest an alternative way of coding for this cmd.
Thanks,

Steve

--

Dave Peterson


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Problem: vba code for creating a button to save worksheet as C

What is the line that causes the error?



yasser wrote:

This is the error message I get:

[ Run-time error '91': Object variable or With block variable not set ]

"Dave Peterson" wrote:

Maybe you're looking at the wrong worksheet?

ThisFile = activeworkbook.worksheets("Sheet1").Range("A1").Va lue

If that doesn't help, maybe you can post the exact error you get.



caldog wrote:

Always the word 'Current' and then a three digit number, with no slashes or
hyphens in it or spaces.

Example: 'Current112'

Steve

"Dave Peterson" wrote:

What's the value in A1?

If you put the date in there, remember that you can't use slashes in
filenames--at least in Windows.

caldog wrote:

Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub

I have created a button that would save the worksheet as the value in cell A1.
I keep getting an error with the above code. Can someone point out where I
am going wrong , and suggest an alternative way of coding for this cmd.
Thanks,

Steve

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Problem: vba code for creating a button to save worksheet as Cell


caldog wrote:
Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs Filename:=ThisFile

End Sub


I have created a button that would save the worksheet as the value in cell A1.
I keep getting an error with the above code. Can someone point out where I
am going wrong , and suggest an alternative way of coding for this cmd.
Thanks,

Steve

Your going to need something like :

Public Sub SaveAsA1()

ThisFile = Range("A1").Value

ActiveWorkbook.SaveAs

with .Filename:=ThisFile
end with
End Sub


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
creating a button to activate another worksheet within a workbook Mickeyjay71 Excel Programming 7 October 31st 07 03:24 PM
Creating a Command Button on a worksheet GeorgeJ Excel Discussion (Misc queries) 0 August 1st 07 09:42 PM
Creating some sort of button that will take you to a new worksheet Sonya New Users to Excel 3 May 9th 07 04:26 PM
Great Code : Need Modification - VBA Save Button jbieser[_2_] Excel Programming 0 March 6th 06 05:49 PM
save button in excel to save one of the worksheets with a cell value as its name Colin[_9_] Excel Programming 2 September 21st 04 11:28 PM


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