Save Excel
-
Hi all I am trying to save excel through this code.
Dim sPath As String
Dim stPath As String
Dim strPath As String
Dim ws As WorksheetSet ws = ActiveSheet sPath = ThisWorkbook.Path & "\\" stPath = Replace(ws.Range("A1"), "-", "") strPath = sPath & Replace(stPath, ":", "-") & ".xls" Call ThisWorkbook.SaveCopyAs(strPath)
But i am getting run time error.
Run-time '1004'
Method 'ThisWorkbook' of object _Global failedPlease help me.
-
Hi all I am trying to save excel through this code.
Dim sPath As String
Dim stPath As String
Dim strPath As String
Dim ws As WorksheetSet ws = ActiveSheet sPath = ThisWorkbook.Path & "\\" stPath = Replace(ws.Range("A1"), "-", "") strPath = sPath & Replace(stPath, ":", "-") & ".xls" Call ThisWorkbook.SaveCopyAs(strPath)
But i am getting run time error.
Run-time '1004'
Method 'ThisWorkbook' of object _Global failedPlease help me.
I can't without knowing what the variables ThisWorkbook and ActiveSheet are.
Check out the CodeProject forum Guidelines[^] The original soapbox 1.0 is back![^]
-
Hi all I am trying to save excel through this code.
Dim sPath As String
Dim stPath As String
Dim strPath As String
Dim ws As WorksheetSet ws = ActiveSheet sPath = ThisWorkbook.Path & "\\" stPath = Replace(ws.Range("A1"), "-", "") strPath = sPath & Replace(stPath, ":", "-") & ".xls" Call ThisWorkbook.SaveCopyAs(strPath)
But i am getting run time error.
Run-time '1004'
Method 'ThisWorkbook' of object _Global failedPlease help me.
Call
is a deprecated code word and should never be used. It is only there to support migration of code from non-object orientated VB6 applications. Get rid of it and you code will probably work.If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
-
Hi all I am trying to save excel through this code.
Dim sPath As String
Dim stPath As String
Dim strPath As String
Dim ws As WorksheetSet ws = ActiveSheet sPath = ThisWorkbook.Path & "\\" stPath = Replace(ws.Range("A1"), "-", "") strPath = sPath & Replace(stPath, ":", "-") & ".xls" Call ThisWorkbook.SaveCopyAs(strPath)
But i am getting run time error.
Run-time '1004'
Method 'ThisWorkbook' of object _Global failedPlease help me.
-
I didn't realize Excel was so badly endangered, but if you think this code will somehow manage to save it, then by all means do what you can. EDIT: Sorry, couldn't resist.