|
Hi,
I wrote 2 addins doing the same. one for word 2007 and one for 2013. all works fine in develepment but when I try to load it as a com addin I get the message that it's not a valid office addin. someone knows what I'm doing wrong?
Jan
|
|
|
|
|
Hi.
I have hit a snag. I need to send a continuous data stream to a Access Db using VB 2010. I can only send one instance of it at a time at the moment. Is it possible to send data continuously to a Access Db?
Regards.
|
|
|
|
|
AFAIK, MSAccess does not support streaming out of the box. SQL Server has some functions, but that would be assuming that you are streaming to a single field (most likely a varbinary(max)). If you keept streaming to that single record, you'd end up with a table containing one record and one very huge and hard to manage blob.
I'd recommend you write your stream in chuncks (like now) to some buffer (a queue, or a memory mapped file), and have some other application put those chunks in Access (a record for each chunk).
Is there any reason why you would need to save it as a "continious blob"? You might be receiving data as a very long array of bytes, but that does not mean that you're only allowed to save it in that format
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi.
It must be continuous as another app will get info from that field. The field will be cleared regularly per minute as to curb the size of the field.
I have got it to write to the field but... The loop keeps on freezing the app. What bugs me though is that I coded a MsgBox to confirm the connection; then the app works fine but as soon as I click 'OK' the app freezes.
Any suggestions?
|
|
|
|
|
Gus113 wrote: It must be continuous as another app will get info from that field. The field will be cleared regularly per minute as to curb the size of the field. Those two sentences contradict each other. It should not matter to the consuming process how it is stored, only needs to now whether there is data. A queue in any form would be the way to go. That way the consuming process is also not influenced by any hiccups in reading.
Gus113 wrote: What bugs me though is that I coded a MsgBox to confirm the connection; then the app works fine but as soon as I click 'OK' the app freezes. Sounds like you are doing your processing work in the UI-thread; if that is busy doing other things than it will stop painting. Move your work to a separate thread.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Yeah, this doesn't sound like Access, or any database for that matter, is the proper solution for this problem.
This sounds like more of a thing handled by Message Queuing (MSMQ). But, even this is speculation because we have no idea what this data is, what it's used for, how fault tolerant it needs to be, ... can you go without data at all for a period of time, ...??
As for the app freezing, you're probably doing stuff on the UI thread that you should be doing in a separate thread.
|
|
|
|
|
Thanks Dave. I have got it to work.
|
|
|
|
|
Hi,
I have two sheets. One having warehouse(18 warehouse) and second having shop (50 Shops).
I need to map shops against warehouse within 200 KM.
I have written one code for the same but need to loop it. Code is mentioned below
Code will copy first warehouse from warehouse sheet and paste it against each all 50 shops in shop sheet.
Then one formula in the sheet (already updated in shop sheet) calculate the difference in KM between each shop and first warehouse. Then filtered out shops within 200 km, copy and paste (transpose) against first warehouse in warehouse sheet. Now I want to do same procedure for second warehouse then third till end. Please help
==================================
Sub RADIUS()
Worksheets("SHOP").Activate
AutoFilterMode = False
Range("f2:g4175").Clear
Worksheets("WAREHOUSE").Activate
Range("C2:d2").Select
Selection.Copy
Worksheets("SHOP").Activate
Range("f2:g4175").PasteSpecial _
Operation:=xlPasteSpecialOperationAdd
Application.Calculation = xlCalculationAutomatic
AutoFilterMode = True
Range("A1:h1").AutoFilter Field:=8, Criteria1:="<=200"
Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy _
Worksheets("WAREHOUSE").Activate
Range("e" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End Sub
|
|
|
|
|
|
Please help me in the same
|
|
|
|
|
|
Nobody knows what you exactly want to do, so it's always needed that you understand - at least to a certain extent - the code and methods someone gives you. It would make a lot of sense to read the hints Richard gave you, instead of trying to make him do your homework.
You can loop through your worksheets - assuming here that the shop worksheets are all named something with "Shop" - like this:
Sub LoopWorksheets()
Dim ws As worksheet
For Each ws In ActiveWorkbook.Worksheets
If UCase(ws.Name) Like UCase("Shop*") Then
RADIUS ws
End If
Next
Application.Calculation = xlCalculationAutomatic
End Sub
The UCASE is needed, because the function is case sensitive (looking for "Shop" would not match your sheet "SHOP")! I would also recommend you to rename your method, because "radius" is a math function and might lead to confusion.
Your function would then consume every worksheet that your loop passes:
Sub RADIUS(ByVal sheet As worksheet)
You can also streamline your function a lot. Instead of
Worksheets("WAREHOUSE").Activate
Range("C2:d2").Select
Selection.Copy
sheet.Activate
Range("f2:g4175").PasteSpecial Operation:=xlPasteSpecialOperationAdd
you could just use one line:
sheet.Range("f2:g4175").Value = Worksheets("WAREHOUSE").Range("C2:d2").Value There's no need to activate every worksheet before doing something on/with it. This is only needed in certain cases, e.g. if you explicitly want to "Select" an object (sheet, range, cell etc.). Usually you just reference the range like "sheet.range(...)". For example
ActiveWorkbook.Worksheets("WAREHOUSE").Range("A1:H1").Interior.ColorIndex = 3 will paint your WAREHOUSE sheet titles red.
Regards
Mick
modified 26-Apr-16 10:31am.
|
|
|
|
|
|
Most likely you need to fix your code.
|
|
|
|
|
Hello,
I have a funny question which arises from the effects I recognize in a sample app.
At a certain point the sample app reads the files of a directory into an array. Since the path to "System32" was anyway pre-set in the sample, I realized the array gets filled with 2560 strings in the array - despite of more than 5000 files in that directory. After changing the path to another Windows directory ("System"), the array again filled with 2560 files only... No error in both cases. Then I changed the path to a different directory (holding approx. 6000 files), and the "GetFiles" array got filled with exactly the number of files existing.
I tried this several times with other directories, and it seems that everything works (i.e. reads and counts) fine as long as the path isn't a system directory. Is this behaviour normal? Or what else might be going on?
Thank you for any insights
Mick
|
|
|
|
|
Sounds like you're running a 32-bit application on a 64-bit OS. The File System Redirector[^] intercepts your request to access C:\Windows\System32 , and redirects it to C:\Windows\SysWOW64 instead.
You can either compile your application as 64-bit; use the special SysNative alias for the System32 directory; or P/Invoke the Wow64DisableWow64FsRedirection[^] and Wow64RevertWow64FsRedirection[^] functions to disable the file system redirector for your application.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you, Richard, for sharing the knowledge as well as probable solutions. It's very likely that the 32/64bit thing is the reason for the effect.
As I wrote before, it's a sample app I examined, so right now I don't need the solutions. But now I'm more prepared for that kind of possible surprises There's still some queston marks, since SysWOW64 has only 2517 (not 2560) file entries on top-level, but it's good enough for having a first clue and some attention around that issue.
Regards
Mick
|
|
|
|
|
Be careful with the overloads:
string[] files = System.IO.Directory.GetFiles(@"C:\windows\system32", "*.*", SearchOption.AllDirectories); looks into sub-directories, while the simple form
string[] files = System.IO.Directory.GetFiles(@"C:\windows\system32"); does not.
I think that is the reason for the differences you experienced.
|
|
|
|
|
Thank you, Bernhard - that's indeed a very good point to look at. Unfortunately, right now I can't look up which overload was used in the sample... most probably I deleted it after having the code run for demonstration of its methods. But I'm going to check your hint later today.
|
|
|
|
|
Now, thanks to the insights of my helpers, I could make it clearer. I only checked the top-level number of files using
Directory.GetFiles(pfad, "*.*", SearchOption.TopDirectoryOnly))
Here's what I found:
• there's no redirection to "SysWOW64" once "System32" is specified as path. I can get the files of both, once set as path.
• the result 2560 was correct, but I could only verify this number after setting the system files (etc) to visible in the folder options!
• i.e. the GetFiles method counts hidden files as well (which it is supposed to do)
So in the end my question arose out of not considering that, in the Windows directory and it's subdirectories, many files are hidden and/or system files. The GetFiles method was completely ok, only my verification wasn't.
Thank you
Mick
|
|
|
|
|
Hi all,
I feel pretty much lost, despite (or because of?) of reading tons of material about delegates already. Maybe someone could help me understand a bit more and give me some hints?
I have
a) an MDI Form which serves as a plugin host (implements IPluginHost from b)
b) a plugin interface (defining "IPlugin" with an event named UIUpdate, "IPluginHost" and a delegate "UIUpdateDelegate")
c) a plugin (referencing IPlugin)
The plugin class holds a custom control, which works on a long lasting task in a separate thread. The custom control is not only supposed to report the progress of this task to it's own UI (which works), but to the MDI forms Interface as well. If ok, I want to see the progress bar counting up in both of the forms.
In a sample I saw that the plugins long lasting tasks method contained
DirectCast(Me.MdiParent, FrmMain).OnUpdateMe("Loading " & i.ToString, i) <----- not working
Me.OnUpdate("Loading " & i.ToString, i) <----- working
to report the progress to both UIs. This doesn't seem to work with the plugin pattern: The type "FrmMain", having an additional "onUpdateMe" Method, is unknown to the compiler, but replacing it with standard "Form" type doesn't work since this doesn't have the "onUpdateMe" Method. Considering it's a plugin, it would anyway make much more sense to learn how to address the MDI parent form without knowing its type, if that's possible.
Before I have to run around in circles for another few days, please help me out of this trap...
Thank you in advance
Mick
|
|
|
|
|
Hi,
I need to delete the folder C:\Windows\System32\Macromed using vbscript but I consistently get access denied no matter how my code is written. I have used an admin prompt to run the script and used psexec to get System rights but get the same access denied result.
•File Explorer - Can't delete manually without responding to request for elevated privileges. I don't want to click the Continue button because that is likely not the configuration for 99.9% of the clients that I will deploy against.
•User CMD - cannot delete folder with RD using command window
•Admin CMD - script cannot delete the folder
•System CMD (psexec) - script cannot delete the folder.
•Trying to shell out to run RD won't work either.
I thought that this could be due to files existing in subfolders but I get access denied when trying to delete just the files to empty the folder. This folder is created when Flash Player is installed but in this case, Flash Player is removed but the folder is left behind. I think it's unlikely that any of the files (4) involved are in use.
Inspecting the security settings shows me that the folder owner is System with full control and Trusted Installer also has full control. System gets an access denied message when it tries to delete the folder even though System is the owner.
How can I change the folder security so it will allow the script to delete the folder? I am using basic code seen in just about any example given for fso.DeleteFolder. I have seen a few forums that recommend using icacls.exe. I haven't tried that one yet but intend to.
Thanks,
Rob
modified 21-Apr-16 16:45pm.
|
|
|
|
|
The account the the code is running under either doesn't have permissions or the files inside the folder are in use by some running instance of Flash or a plugin in currently running browser. Those are the circumstances you get "Access Denied" under.
|
|
|
|
|
Do you want to delete the folder in any possible way or only with VBScript?
I had the problem that I couldn't delete a big bunch of older windows installation files and, with the help of a real 'guru', found a working solution using shell commands - it was the only working solution I found in many months. It was a matter of broken permissions. To fix really broken permissions, the best is to run these two commands one after the other (Admin Shell):
takeown /f "C:\path\to\folder" /r
icacls "C:\path\to\folder" /reset /T
The first one will give you ownership of all the files, however that might not be enough, for example if all the files have the read/write/exec permissions set to "deny". You own the files but still cannot do anything with them. In that case (which I had) run the second command, which will fix the broken permissions.
I don't know if it would work to call these functions from VBScript, maybe it's worth a try. I'm using Win7, but for Win8.1 it should work the same.
Regards
Mick
|
|
|
|
|
Dear Friends
i have no knowladge on networking so i really dont know how to get this work. it seams like group of classes and how can i intigrate it with my forms to try it ? pleas help me out i need it so badly . can any one show me how to get it working ?!
if you could build it in vb and share it with me as a zip file i would be thankful.
there are the offical examples
1. Client : Example
2. Server : Example
Thanks In Advance
|
|
|
|