|
|
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 Worksheet
Set 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 failed
Please help me.
|
|
|
|
|
I can't without knowing what the variables ThisWorkbook and ActiveSheet are.
|
|
|
|
|
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.
|
|
|
|
|
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.
|
|
|
|
|
DAMN, I would have answered exactly the same, but you beat me to it...
|
|
|
|
|
Hi,
Does anyone have a link showing how to insert images into a powerpoint presentation using vb.net?
Thanks,
|
|
|
|
|
|
|
Hi everyone,
Does anyone know how to save an image from the clipboard as a picture (jpef, png, etc). using vb.net code?
Thanks!
|
|
|
|
|
b-rad311 wrote: Does anyone know how to save an image from the clipboard as a picture
That is almost perfect VB code, use the Clipboard class and the Image class, the GetImage() method and the Save() method. What could possibly be the problem?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi Luc,
Thanks for replying. I'm new to vb so I was looking for specific examples of how to do this. However, I just found a specific example online, so I've got it now.
Thanks
|
|
|
|
|
b-rad311 wrote: I'm new to vb
I hope you mean VB.NET (VB6 and earlier are stinkin' dead and should remain buried).
You should buy and study a book when you're new to a language; it is the fastest way to make real progress, and the only way to learn it properly. And then read up again on the classes you intend to use. We both have named them already.
If all that is not going to happen, the least you should do is search CodeProject for some articles that deal with your topic; there are some 20K articles here, lots of them are pretty good.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Yes, vb.net is what I meant.
|
|
|
|
|
Hi, dear all,
I know this is wrong place. but I really don't where I should post the question.
I am working on a VB6 project created years ago which use Wise InstallMaster to create installation file. I totally have no idea about it.
If you know anything about it, please tell me. If you can give me some tutorial link, that's best.
|
|
|
|
|
You haven't asked an answerable question. You want someone to tell you how to use a dead piece of software? Symantec now owns the Wise suite of products. You're best bet is to peruse their site and see if you can find the documentation on it.
|
|
|
|
|
Dave,
Thanks for your instruction.
|
|
|
|
|
Hi All
How can i open excel file with password option?I have a excel file "Test.xls" which is password protected.I know password,i want to open "Test.xls" through code.Please help me
|
|
|
|
|
'fileName = full location of your excel document
Public Sub OpenExcel(byval fileName as String)
Dim ExcelInstance As New Microsoft.Office.Interop.Excel.Application()
Dim File As New System.IO.FileInfo(fileName)
ExcelInstance.Workbooks.Open(File.FullName, , , , "password", , , , , , , , , , )
End Sub
|
|
|
|
|
Hello Everybody,
I have a listbox in which i want to get the data from Excel Data Sheet. So I am writing code for getting data from excel file to Listbox.I am Providing Range From (A1:A100000) to (XFD1:XFD100000). But it takes a lot of time.So Please help me.
I have a secondry question How to Check Excel Datasheet is Empty.
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: I am Providing Range From (A1:A100000) to (XFD1:XFD100000). But it takes a lot of time.
Calculate how many Excel cells that is. It would then probably come as no surprise that it takes a lot of time, epecially to fill a listbox.
Without seeing any code it's impossible to suggest how this might be improved.
As to the second question, IIRC correctly, Excel has a UsedRange function (or something similar) that might be helpful.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Thanks Sir
It works Fine but i have generate a second question regarding same topic.
While i am using the Import data from Excel to List there are Excel Applications will be open.
So please describe me how to close it.
If you can think then I Can.
|
|
|
|
|
Assuming you've got something like this:
Dim objExcel As Excel.Application = Nothing
objExcel = New Excel.Application
Then something like this could do it:
If Not (objExcel Is Nothing) Then
objExcel.Quit()
objExcel = Nothing
End If
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
Thanks Dear
Actually i was finding the close or exit method.
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: I am Providing Range From (A1:A100000) to (XFD1:XFD100000). But it takes a lot of time.
Seriously?? What user on this earth would want to look through a ListBox with BILLIONS of items in it?? Rethink what you're doing and how your user interface is going to work.
|
|
|
|