-
Jan 14th, 2021, 11:37 AM
#1
Thread Starter
New Member
adapt vb code to be used with microsoft excel vba
adapt vb code to be used with microsoft excel vba
Good evening.
I seem to have understood that it is possible to use the vb code also for excel macros.
I found this link on the web that allows with vb to send sms using the nokia gsm phone:
http://www.scampers.org/steve/sms/samples.htm#at
It is possible to know if the code can be inserted in an excel macro module and if it is possible what adaptations need to be made.
Thanks
-
Jan 14th, 2021, 12:33 PM
#2
Addicted Member
Re: adapt vb code to be used with microsoft excel vba
Hello
I do this almost every week - the joining of VBA and VB6
But the best way to start is to use the macro recorder in excel (or whatever) and then Frankenstein the code using VB6. Also with research on the net
Hope I kind of helped
Jeff
-
Jan 14th, 2021, 01:01 PM
#3
Thread Starter
New Member
Re: adapt vb code to be used with microsoft excel vba
Originally Posted by habenero
Hello
I do this almost every week - the joining of VBA and VB6
But the best way to start is to use the macro recorder in excel (or whatever) and then Frankenstein the code using VB6. Also with research on the net
Hope I kind of helped
Jeff
I would like to know if the same code can be inserted in an excel module or if it needs to be adapted
-
Jan 14th, 2021, 01:06 PM
#4
Addicted Member
Re: adapt vb code to be used with microsoft excel vba
ok - will look into it
can you post some VBA and then I can see if I can help
Jeff
-
Jan 15th, 2021, 02:03 AM
#5
Thread Starter
New Member
Re: adapt vb code to be used with microsoft excel vba
Originally Posted by habenero
ok - will look into it
can you post some VBA and then I can see if I can help
Jeff
Is the opposite.
I would like to make the vb code of the posted link suitable for use as an excel vba macro.
Could you help me with this?
-
Jan 15th, 2021, 02:50 AM
#6
Re: adapt vb code to be used with microsoft excel vba
you can use a lot of vba code in vb6, you should avoid using active anything, selecting or selection object. all ranges should be fully qualified to a application.workbook.worksheet object
like
Code:
set sht = xlapp.workbooks("myworkbook").sheets("sheet1")
sht.range("a1").value = 275454
where xlapp is an excel application object, the sht object can then be used for all ranges and other objects within that worksheet, while it remains in scope, any unqualified objects may work sometimes and then not
well written vba code will mostly just work, but often vba code needs upgrading to work reliably
you can use early binding or late binding to an excel object, the latter is excel version independent, whereas the former will only work with that specific version of excel
i do not believe that any 64 bit calls from vba can be implemented in vb6, but most code will still run in 64 bit versions of excel, though as i do not have any 64 bit version i can not test
edit: i doubt there is any serious problem converting the SDK code from the link to vba, just need to download and add a reference to NokiaCLMessaging, but it is not included in the sample programs as far as i could see
Last edited by westconn1; Jan 15th, 2021 at 03:06 AM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|