Hi Marek,
read your post just now, how do I do that and is it working for xlsx too? (csv?)
Robert
At last I reached the harbour
Moderator: Rathinagiri
- serge_girard
- Posts: 3167
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: At last I reached the harbour
Hi Robert,
Is this what you mena/want?
You only need to adjust xls-name, dbf-name plus all field names.
Serge
Is this what you mena/want?
Code: Select all
#include <hmg.ch>
Function Main
DEFINE WINDOW Win_1 ;
ROW 0 ;
COL 0 ;
WIDTH 440 ;
HEIGHT 240 ;
TITLE 'Excel to DBF' ;
MAIN
ON KEY ESCAPE ACTION Win_1.Release
DEFINE MAIN MENU
DEFINE POPUP "Conversion"
MENUITEM 'Import Excel data' ACTION ImportData()
END POPUP
END MENU
END WINDOW
Win_1.Center
Win_1.Activate
Return
Function ImportData
LOCAL oExcel, oWorksheet, i
IF ! MsgYesNo('Start to process?','Confirm')
return
endif
oExcel := CreateObject( "Excel.Application")
oExcel:Workbooks:Open( GetCurrentFolder()+"\newshop.xls" ) // here right name
oExcel:Visible := .t.
sele a
use shoptype
zap
for i = 4 to 7 // here
cTypeO=oExcel:WorkSheets(1):cells(i,2):value
cTypeN=oExcel:WorkSheets(1):cells(i,3):value
cCustCode=left(oExcel:WorkSheets(1):cells(i,4):value,6)
cCustName=subs(oExcel:WorkSheets(1):cells(i,4):value,8,50)
appe blank
repl typeo with cTypeO, typen with cTypeN, cust_code with cCustCode, cust_name with cCustName
next
close databases
Return
Serge
There's nothing you can do that can't be done...
Re: At last I reached the harbour
Hi,
@ Marek: in my office at work I use excel, at home I use free office,
@ Serge: that is via activeX ? I will have a look at this, never used that before, right now I am glad with append from sdf. Have to learn so much new things, but the app I am programming shows progress.
Thank you
@ Marek: in my office at work I use excel, at home I use free office,
@ Serge: that is via activeX ? I will have a look at this, never used that before, right now I am glad with append from sdf. Have to learn so much new things, but the app I am programming shows progress.
Thank you
Re: At last I reached the harbour
BTW: I have opened a topic in "HMG Tutorial and Tips". Title: "How do I call a procedure" and I got useful answers, what I mean, I should not have used the self-introduction area to post problems, my fault.
Robert
Robert
- serge_girard
- Posts: 3167
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: At last I reached the harbour
Robert,
This is not via ActiveX. ActiveX (see examples) is used with webpages-url-internet etc.
Serge
This is not via ActiveX. ActiveX (see examples) is used with webpages-url-internet etc.
Serge
There's nothing you can do that can't be done...