Need help with VB code


 
Thread Tools Search this Thread
Top Forums Programming Need help with VB code
# 1  
Old 12-31-2014
Need help with VB code

Hello All,

I need a little help with a piece of Visual Basic coding. I have the following code:

Code:
Sub Assign_New_DB_Report()
Sheets("Main Dashboard Summary").Visible = True
Sheets("Main Dashboard Summary").Select
pdfName = ActiveSheet.Name
    ChDir ActiveWorkbook.Path & "\"
    fileSaveName = ActiveSheet.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="Report.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=False
Sheets("Report").Visible = False
Sheets("Sheet").Select
Range("S6").Select
Dim olLook As Object
Dim olNewEmail As Object
Dim strContactEmail As String

As you may already know, it takes the default folder location configured in my Excel options and saves the file there. I would like to send the file to D: instead of the default C:. I've tried simply changing "\" to the path where I would like the file saved, but it doesn't work.

Any help offered would be appreciated.

Thanks.

---------- Post updated at 12:45 PM ---------- Previous update was at 09:24 AM ----------

Used the ChDrive instead. It works now.

Thanks.
# 2  
Old 12-31-2014
Not to nit pick, but the description should probably have said, "Need help with VBA code". There are differences between VB and VBA as well as similarities.

Not too many people writing VBA code behind Excel anymore. Have you looked into Access with a better back end, such as mySQL? You can use ODBC to link each table into the mySQL database. It will give you the ability to use forms and reports, while keeping your data in an actual database. Using Access with mySQL will also allow it to scale to far more users, provided you create some indexes and do basic data modeling. Of course I don't know what exactly is in the spreadsheet... Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Linux

Go to a line of code , skip few lines of code

Hi , I have a code where i am using a infinite while loop . some thing like below while do if then #go to line 20 fi command 1; command 2; #line 20: sleep 34; (5 Replies)
Discussion started by: Paarth
5 Replies

2. Shell Programming and Scripting

Block of code replacement in Java source code through Unix script

Hi, I want to remove the following code from Source files (or replace the code with empty.) from all the source files in given directory. finally { if (null != hibernateSession && hibernateSession.isOpen()) { //hibernateSession.close(); } } It would be great if the script has... (2 Replies)
Discussion started by: hareeshram
2 Replies

3. UNIX for Dummies Questions & Answers

If ‘922’ Code does not exist on ‘03’ Record, ‘901’ Code will be there instead, move ‘03’ R

01,011600033,011600033,110516,0834,2,90,,2/ 02,011600033,011103093,1,110317,0834,,2/ 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+000000 00354,,/ 03,113806,,015,+00000559618,,,901,+00000000096,,,922,+000000 00621,,/ 88,902,+0000000025218,,/... (1 Reply)
Discussion started by: sgoud
1 Replies

4. Shell Programming and Scripting

translate ksh code to csh code

hi all, Can any 1 help me translate this korn shell code to C shell code : email=$(grep "^$1" $folder/config_2.txt | awk '{print $2'}) In config_2.txt the content is : which mean in korn shell , $1=groupname and $2=email address. Now i need to write in C shell script,when i set the... (2 Replies)
Discussion started by: proghack
2 Replies

5. Programming

how i prepare a c++ code(c code) for implementing my own protocol format

helo my protocol format is given below { destno,mode,no.of packet,pktsize,,pktno,textsize,CRC} description:- { is starting flag destno - 4bytes mode - 1 byte no.of pkt - 4byes pktsize - 6 bytes ... (1 Reply)
Discussion started by: amitpansuria
1 Replies

6. UNIX for Advanced & Expert Users

Return code from PL/SQL Code

Hi Guys, I was just wondering if anybody can help me with this problem. OK, how we can get a value back from PL/SQL Script (not stored procedure/function) See the below example: (for example aaa.sh) #!/bin/ksh VALUE=`sqlplus -s user/password@test_id <<EOF @xxx.sq EOF` echo $VALUE ... (7 Replies)
Discussion started by: Shaz
7 Replies
Login or Register to Ask a Question