I am asking the first question on this site because I'm stuck in a problem.
Sorry for my bad English.
I'm creating a DataBase with some coding on VBA.
Some days ago I wrote some code which creates a folder on a ftp server. And it was working fine!
Today I picked up the database and testing this function and it creates a folder but with a different weird name every time.
I tried everything such as: change the windows encoding, reading the ftp server manual (there aren't changes from the last time!), testing it on a different database...but nothing happened.
I post the code maybe there is something I accidentally change.
thank you for your support!
Private Sub Tester_Logger_Click() ' TESTER
Dim hConnection, hOpen As Long
' Open Internet Connecion
hOpen = InternetOpen("FTP", 1, "", vbNullString, 0)
' Connect to FTP
hConnection = InternetConnect(hOpen, "IP", "21", "MYUsername", "MYPassword", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)
FtpCreateDirectory hConnection, "\\TestFolder"
' Close Internet Connection
Call InternetCloseHandle(hOpen)
Call InternetCloseHandle(hConnection)
End Sub
EDIT:
I can create folders with FileZilla and from Windows Command Line.
I also used the command "status" (from the windows command line) to see the proprieties:
Type : ascii, Verbose: On, Bell: Off, Prompting: On, Globbing: On, Debug: Off, Hash: Off.
The weird name when i create a directory with the code above is: "xӺ �" If I run it the second time it creates a directory with this name: "(j��"
EDIT 2: I don't have a second computer, but i tried to change ftp host service and it happen again. I don't know if it's a problem of Office/Windows Upragrading. I'm sure that i did not touched anything. I tried to use a old backup version of the Database and nothing change... i have always this strange characters when i'm creating a new directory.
When I try to upload something it seems that it can't read the name of the folders. The Folders are created correctly with FileZilla and they are there, i Checked!
I read somewhere that maybe it's a problem of encoding. There is a note on FileZilla that says if there is no matching with encoding there will be problems with characters reading.
EDIT 3: I tried to reset to default settings VBA and Microsoft Access whit regedit and nothing happened.
I also tried to use different functions;
I used InternetconnectW,InternetOpenW, and FtpCreateDirectoryW instead of internetConnectA etc... because is written on the Microsoft guide those are functions for the Unicode encoding. But it's always the same.
Please someone can help me?
Thank you.
Related
I'm automating some reports using visual basic. I've recorded some scripts that worked fine by seem to have stopped working for reasons unknown. I record the following (comments added) and the script fails at a file dialog box.
session.findById("wnd[0]").resizeWorkingPane 95,22,false
session.findById("wnd[0]/tbar[0]/okcd").text = "se16"
session.findById("wnd[0]").sendVKey 0
' Run AGR_TCODES
session.findById("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").caretPosition = 10
session.findById("wnd[0]").sendVKey 0
'Select Extended Name, Multiple selection
session.findById("wnd[0]/usr/btn%_I3_%_APP_%-VALU_PUSH").press
session.findById("wnd[1]").sendVKey 23
' select file
session.findById("wnd[2]/usr/ctxtDY_PATH").text = "c:\my_directory\"
session.findById("wnd[2]/usr/ctxtDY_FILENAME").text = "myfile"
session.findById("wnd[2]").sendVKey 0
Its at this point in script playback that the script just stops with the file select text inputs blank. I can type the information in, but that kinda defeats the purpose. I can't find the reasons or a cause, but lots of various upgrades have occurred, including my laptop and a reinstall of the os to WIN10. I don't really care why - but I do need to find a way around it.
There are 2 scenarios I've identified:
It appears that SAP occasionally loses the focus of dialog boxed. Use gratuitous .setfocus commands on the window to compensate
It appears that uploads via scripts may be blocked by security settings. You can do it manually, but not via script. A telltale sign is that when you record the script, your inputs are not recorded. So the DY_FILENAME.text line will be completely missing from the recording. I'm not sure how to fix this, but at least you know where to look!
Good luck with your scripts.
I have some code in VC++ that create windows explorer shell integration and shows some remote database folders in windows explorer as native folders. When I use "move to folder..." from the explorer menu and move some file to that virtual folder, windows give me error message "The target can't handle this type of document", even though the shell integration successfully moves the file to the database.
I am not able to find out what is the cause of that error and how to disable the same from my code, what configuration is needed.
Does anyone has an idea about the same.
I finally figured it out, Drop was returning hr instead of S_OK. the hr value came from some other method call and was wrongly returned as something else instead of S_OK.
It just in one of the if condition, the original developer has forgotten to set the hr value correctly. normally hr values are not used, it just for storing the result of a method call and returning the same at the end, so its very hard to figure what is wrong, because all methods are working properly.
These silly mistakes are hard to find, though easy to fix.
Thanks Denis for pointing where to look.
I maintain a PowerBuilder Classic 12.5 application which has functionality to print checks on a Source Technologies MICR printer. The application has been running fine in a Windows XP environment. We are trying to move to a Windows-7 operating system and the check printing no longer works.
Here is the issue. PowerBuilder issues a PrintOpen followed by several Print commands to send command strings to the printer to unlock MICR mode and various secure fonts:
il_job = PrintOpen( )
Print(il_job,'&%STF[password]$')
Print(il_job,'&%SMCPFFFF$')
Print(il_job,'&%STP10003$')
Print(il_job,'&%STP10002$')
Print(il_job,'&%STP10001$')
Print(il_job,'&%1B$&u600D')
Print(il_job,'&%1B$*t600R')
This works fine on XP, and if you redirect the printer to "print to file", you can see the command strings right there in the file.
In Windows-7, the printer does not recognize the command strings, and in fact, just prints the commands on the check stock. If you do the same "print to file", you can see the commands in there, but each character in the command string is separated by other characters.
The following is a sample taken from the "print to" file, and you can see the string '&%SMCPFFFF$' by looking at each character that precedes an asterisk (*).
*p171Y&*p50X%*p100XS*p150XM*p200XC*p250XP*p300XF*p350XF*p400XF*p450XF*p500X$
This would seem to be a print driver issue, and in fact, Source Technologies now provides a "Universal Print Driver" which we have been told to use. Our PC support person was able to get the check printing working temporarily by re-installing the old print driver that we used on Windows XP, but as soon as the printer is turned off and on again, it resets to the new universal driver.
I tried using PrintDefineFont and PrintSetFont, to set the font to Courier Regular 8pt (which is what the Tech Support guy at Source Technologies told us we needed), but that didn't help:
PrintDefineFont(il_job, 1, "Courier", -8, 400, Fixed!, AnyFont!, FALSE, FALSE)
PrintSetFont(il_job, 1)
Can anyone help me with this issue? Or suggest where I might get help.
Thanks.
Try this: Add a new printer. Select the port your printer is connected to. Select Manufacturer: Generic, Printer: Generic/Text only. When you print to this printer it should send exactly what's in your Print statements to the printer.
Thanks Hugh, I tried your suggestion which sounded good, but unfortunately it had no effect.
As it happens, as of yesterday I did resolve the last of the printing issues. I had to address each of the special fonts (micr line, signature, check amount etc.) individually, and used a combination of using PrintDefineFont/PrintSetFont, embedded printer command strings to reset the font, and changing a Column control in the datawindow to a Text control (a printer command string is moved into this field as well as the data, and the one worked, the other didn't).
Appreciate your help.
Les
Please right click on your software and go to compatibility mode and select "Windows XP with SP3" in it, click APPLY and OK.
Confirm if the software now send print commands perfectly?
Bizarre problem.
I am using Excel VBA to control IE and download data from web sites. Pretty vanilla.
I experience an error that only happens when I am running Windows 8.1 and IE 10. On a second PC, which is running Windows 7 and IE 8, the code works fine.
Here is the behavior.
I call the following code to open a web page:
Set appIE = CreateObject("InternetExplorer.Application")
With appIE
.navigate sURL 'Where sURL is a valid web address
End With
This works fine, and opens a browser.
Shortly afterwards, I call the following:
With appIE
.navigate sURL'a different valid web address
End With
An error message pops up at the .navigate line. The message says:
Run-time Error '-2147024726(800700aa)'
Method 'Navigate' of object 'IEWebBrowser2' Failed
I have looked up this error message and the only thing that I can find is that it may relate to spyware. But I completely reinstalled the OS and all apps on the system and the same thing happened.
Another very strange phenomenon is that if I put a trace point in-between the above two sections and pause the code, then manually start the code again, everything works fine. But if, instead of me putting in a trace point I put in a wait loop, I get the same failure. That is, if I manually pause and then resume the code, the code works, but if I automate a pause and resume, the code does not work.
As you consider this situation, please remember that everything works fine under Windows 7 and IE 8, and everything works fine if I manually pause and restart.
Does any of this make sense?
1- Please Check sURL (if you check, please check again compiled folder)
2- Delete WebBrowser Control and Add New
Me forget copy original file App.Path + "\error.html" and see this problem.
As the title says, I've got a word template with macros that does not run properly in the new Word version from Office 2011 for MAC.
The thing which seems to not work properly is the following code:
Sub Document_New()
myForm.Show
End Sub
The same is with Document_Open()
It doesn't seem to run this code on the Mac version.
Does anyone know why this won't work on the Mac, or if there's another way around to emulate the document_open/document_new function?
EDIT: The document is in the .dot format. And I tried to save it to .doc, then the Document_open() worked just fine, so it seems to not be working in the .dot format.. And Document_New() is not running in .doc since its not a new templatefile based on a document..
EDIT 2: Seems like it was a once only with the Document_open on .doc files. I cant make it work again. So weird! The only event I get working, and this is only when using the .doc file format, is Document_Close() - this works everytime...
EDIT 3: This is just getting weirder. I made a new .doc document with the following code:
Private Sub Document_Open()
MsgBox ("BlaBlaBla")
End Sub
The code only runs if the Visual Basic Editor is open BEFORE I close the word file and try to open it again. If I close the Visual Basic Editor and then the word file, and then open the word file; The code is not run.
??
All VB application events are suppressed if you have the VB-editor active, and the current project is not running. It is an intentional behavior, to prevent unwanted code execution, hence not debuggable.
I have used Workbook_Open() (in Excel), and I can only see it working on newly open Excel Xls (xlsm on 2010), from a non-open VB-editor Excel application.
It will work if you have other doc/xls already open, but not if vb-editor is up.
Have you checked whether Macros are allowed? Do you have generated a certificate and setup your application as a trusted source?
I'm having similar issues. It seems that MS removed support for the Document_New and Document_Open functions in the Word object model for Word 2011. See http://mac2.microsoft.com/vb/1033/Word/html/womscChangesBetweenWord2010and2011.htm