OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Scripts inside VBA Corel Macro? (http://forum.oberonplace.com/showthread.php?t=7213)

0meg@ 20-11-2010 08:25

Scripts inside VBA Corel Macro?
Question: can i use for example WSH call or even more! assembler directives inside my macro. I believe i can, but don't know how.

shelbym 20-11-2010 10:30

WSH should work fine, I have never tried anything in assembler.


0meg@ 13-12-2010 02:09

How can i use SetLocale from WSH in my VBA for Corel Macro. The reason is too large code to change locale by VBA.

Alex 14-12-2010 06:41

Just curious, why do you need to change the locale?

0meg@ 16-12-2010 03:44

I working in Russia, some of designer's computers en locale and other ru locale but all of them use some net folder named in english with month's name. My macro for automation builds the path and the code in WSH is:

strPath2Lnk = objFSO.BuildPath(objWshShell.SpecialFolders("SendTo"), "Send to NetPrinterFolder.lnk")

prevLocale = SetLocale("en-us")
dtNow = Now()
strTargetPath = objFSO.BuildPath( _
"\\Print\Work", Right("00" & CStr(Month(dtNow)), 2) & "_" & MonthName(Month(dtNow)) & "\" & Right("00" & CStr(Day(dtNow)), 2) _

But there is no simple way to change locale in VBA for my purpose.

Alex 25-12-2010 15:57

Since you are always using English month names, why not just hard-code them like this:


Function EnglishMonthName(ByVal nMonth As Long) As String
    Dim monthNames() As Variant
    monthNames = Array("January", "February", "March", _
            "April", "May", "June", "July", "August", _
            "September", "October", "November", "December")
    EnglishMonthName = monthNames(nMonth - 1)
End Function

Then you can use this function instead of VBA's MonthName

0meg@ 26-12-2010 00:08

Thank you, i was trying to decrease code.

All times are GMT -5. The time now is 19:12.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com